Skip to content

Instantly share code, notes, and snippets.

@thekhairul
Created April 3, 2022 04:31
Show Gist options
  • Save thekhairul/5dd0c76a4fb661875afaafe1132a133e to your computer and use it in GitHub Desktop.
Save thekhairul/5dd0c76a4fb661875afaafe1132a133e to your computer and use it in GitHub Desktop.
Leetcode remove duplicates from sorted array with python3
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