Skip to content

Commit 4b35655

Browse files
authored
Merge pull request vJechsmayr#235 from tanmoyee04/master
uploaded Problem no. 62 i.e. Unique Paths
2 parents b194104 + 72191da commit 4b35655

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

LeetCode/0062_Unique_Paths.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class Solution:
2+
def uniquePaths(self, m: int, n: int) -> int:
3+
return math.factorial(n+m-2)//(math.factorial(m-1)*math.factorial(n-1))
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Definition for singly-linked list.
2+
# class ListNode:
3+
# def __init__(self, val=0, next=None):
4+
# self.val = val
5+
# self.next = next
6+
class Solution:
7+
def deleteDuplicates(self, head: ListNode) -> ListNode:
8+
if head==None:
9+
return head
10+
current= head.next
11+
prev=head
12+
while current!=None:
13+
if current.val==prev.val:
14+
prev.next=current.next
15+
current=current.next
16+
else:
17+
current=current.next
18+
prev=prev.next
19+
return head

0 commit comments

Comments
 (0)