Created
April 2, 2022 07:21
-
-
Save mdpabel/1bd153ec9e84de9c518fad3c83bce30e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def removeDuplicates(self, nums: List[int]) -> int: | |
k = 0 | |
n = len(nums) | |
for i in range(1, n): | |
if nums[i] != nums[i - 1]: | |
nums[k] = nums[i - 1] | |
k += 1 | |
nums[k] = nums[n - 1] | |
k += 1 | |
return k |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment