Skip to content

Commit 308bb83

Browse files
committed
contains-duplicate solution
1 parent fe10e8f commit 308bb83

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

contains-duplicate/mintheon.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import java.util.Arrays;
2+
3+
class Solution {
4+
public boolean containsDuplicate(int[] nums) {
5+
Arrays.sort(nums);
6+
for(int i = 1; i < nums.length; i++) {
7+
if(nums[i] == nums[i - 1]) {
8+
return true;
9+
}
10+
}
11+
return false;
12+
}
13+
}

0 commit comments

Comments
 (0)