Created
April 3, 2022 04:31
-
-
Save thekhairul/5dd0c76a4fb661875afaafe1132a133e to your computer and use it in GitHub Desktop.
Leetcode remove duplicates from sorted array with python3
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(nums): | |
nums[:] = [x for idx, x in enumerate(nums) if idx == 0 or x != nums[idx - 1]] | |
return len(nums) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment