We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 559dfdb + c095286 commit 8f47a65Copy full SHA for 8f47a65
contains-duplicate/codyman0.py
@@ -0,0 +1,16 @@
1
+"""
2
+https://leetcode.com/problems/contains-duplicate/
3
4
+
5
+# Time complexity : O(n)
6
7
8
+class Solution:
9
+ def containsDuplicate(self, nums: List[int]) -> bool:
10
+ sortedArray = sorted(nums)
11
+ for i in range(len(sortedArray)):
12
+ if i == len(sortedArray) - 1:
13
+ return False
14
+ if sortedArray[i] == sortedArray[i + 1] :
15
+ return True
16
0 commit comments