update 26
This commit is contained in:
parent
cefd877d93
commit
86ede65962
@ -1,13 +1,16 @@
|
||||
# Remove Duplicates from Sorted Array
|
||||
# -100 <= nums[i] <= 100
|
||||
|
||||
|
||||
class Solution:
|
||||
def removeDuplicates(self, nums: list[int]) -> int:
|
||||
count = 0
|
||||
tmp_num = -999
|
||||
for num in nums:
|
||||
if num == tmp_num:
|
||||
for number_index, number in enumerate(nums):
|
||||
if number == tmp_num:
|
||||
nums.pop(number_index)
|
||||
continue
|
||||
count += 1
|
||||
tmp_num = num
|
||||
tmp_num = nums[number_index]
|
||||
|
||||
return count
|
||||
|
Loading…
x
Reference in New Issue
Block a user