update project structure
This commit is contained in:
16
leetcode_py/26.py
Normal file
16
leetcode_py/26.py
Normal file
@@ -0,0 +1,16 @@
|
||||
# Remove Duplicates from Sorted Array
|
||||
# -100 <= nums[i] <= 100
|
||||
|
||||
|
||||
class Solution:
|
||||
def removeDuplicates(self, nums: list[int]) -> int:
|
||||
count = 0
|
||||
if not nums:
|
||||
return count
|
||||
k = 1
|
||||
for i in range(1, len(nums)):
|
||||
if nums[i] != nums[i - 1]:
|
||||
nums[k] = nums[i]
|
||||
k += 1
|
||||
|
||||
return k
|
||||
Reference in New Issue
Block a user