update 26
This commit is contained in:
parent
86ede65962
commit
11b2912264
@ -5,12 +5,12 @@
|
||||
class Solution:
|
||||
def removeDuplicates(self, nums: list[int]) -> int:
|
||||
count = 0
|
||||
tmp_num = -999
|
||||
for number_index, number in enumerate(nums):
|
||||
if number == tmp_num:
|
||||
nums.pop(number_index)
|
||||
continue
|
||||
count += 1
|
||||
tmp_num = nums[number_index]
|
||||
if not nums:
|
||||
return count
|
||||
k = 1
|
||||
for i in range(1, len(nums)):
|
||||
if nums[i] != nums[i - 1]:
|
||||
num[k] = nums[i]
|
||||
k += 1
|
||||
|
||||
return count
|
||||
return k
|
||||
|
Loading…
x
Reference in New Issue
Block a user