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.
1 parent f291ae8 commit 42bcda5Copy full SHA for 42bcda5
contains-duplicate/jinhyungrhee.java
@@ -0,0 +1,16 @@
1
+import java.util.*;
2
+class Solution {
3
+ public boolean containsDuplicate(int[] nums) {
4
+ /**
5
+ avg : O(NlogN)
6
+ worst : O(N^2)
7
+ */
8
+ Arrays.sort(nums);
9
+
10
+ for (int i = 1; i < nums.length; i++) {
11
+ if (nums[i-1] == nums[i]) return true;
12
+ }
13
14
+ return false;
15
16
+}
0 commit comments