Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Hemanthkumar2112/d47ca15dcbed00303c2686c90f5dd83e to your computer and use it in GitHub Desktop.
Save Hemanthkumar2112/d47ca15dcbed00303c2686c90f5dd83e to your computer and use it in GitHub Desktop.
remove duplicate within a list
def removeDuplicates(self, nums:List[int]) -> int:
nums.sort()
for i in nums:
while nums.count(i)>1:
nums.remove(i)
print(nums)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment