Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution:
- def removeDuplicates(self, nums: List[int]) -> int:
- # since the array is already sorted we can get away by not using a map
- # also a blunder was made where the unique_tracker was started from 0
- # since it followed a particular pattern that you did in the last question
- unique_tracker = 1
- for i in range(1, len(nums)):
- if nums[i] != nums[i-1]:
- nums[unique_tracker] = nums[i]
- unique_tracker += 1
- return unique_tracker
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement