diff --git a/Contains Duplicate.java b/Contains Duplicate.java new file mode 100644 index 0000000..cef9843 --- /dev/null +++ b/Contains Duplicate.java @@ -0,0 +1,13 @@ +class Solution { + public boolean containsDuplicate(int[] nums) { + Arrays.sort(nums); + int n = nums.length; + for (int i = 0; i < n - 1; i++) { + for (int j = i + 1; j < n - 1; j++) { + if (nums[i] == nums[j]) + return true; + } + } + return false; + } +} diff --git a/README.md b/README.md index 43bd58d..b65e16d 100644 --- a/README.md +++ b/README.md @@ -22,10 +22,10 @@ Below are the instructions for this assignment. Your repository should automatic ### 📝 TODO: Complete this section -* **Your name and PID**: +* **Your name and PID**: Zekun Li, zekunli -* **Your partner's name and PID:** +* **Your partner's name and PID:** Trevor Jarzynka, trevorj04@vt.edu -* **Link to selected coding challenge:** +* **Link to selected coding challenge:**: https://leetcode.com/problems/contains-duplicate/ -* **Summary of partner's interview feedback:** +* **Summary of partner's interview feedback:**: Good job on completing the problem on time