Skip to content

Commit c09339f

Browse files
authored
Create 26-Remove-Duplicates-from-Sorted Array
1 parent 01a2b36 commit c09339f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class Solution(object):
2+
def removeDuplicates(self, nums):
3+
"""
4+
:type nums: List[int]
5+
:rtype: int
6+
"""
7+
k = 0
8+
i = 0
9+
while i < len(nums):
10+
val = nums[i]
11+
while i + 1 < len(nums) and nums[i+1] == val:
12+
nums.remove(val)
13+
k += 1
14+
i += 1
15+
return len(nums)
16+

0 commit comments

Comments
 (0)