Skip to content

Instantly share code, notes, and snippets.

@Ayoush
Created November 21, 2023 05:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ayoush/93c084bd0ed92e254974cc7dd5e3f870 to your computer and use it in GitHub Desktop.
Save Ayoush/93c084bd0ed92e254974cc7dd5e3f870 to your computer and use it in GitHub Desktop.
contains_duplicate
def containsDuplicate(self, nums):
if len(nums) == 1:
return False
nums.sort()
for i in range(1, len(nums)):
if nums[i-1] == nums[i]:
return True
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment