Created
July 3, 2021 13:52
-
-
Save Hemanthkumar2112/d47ca15dcbed00303c2686c90f5dd83e to your computer and use it in GitHub Desktop.
remove duplicate within a list
This file contains hidden or 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: | |
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