Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public:
- bool containsDuplicate(vector<int>& nums) {
- sort(nums.begin(), nums.end());
- int n = nums.size();
- for (int i = 0; i < n - 1; i++)
- {
- int razlika = nums[i + 1] - nums[i];
- if(razlika == 0)
- {
- return true;
- }
- }
- return false;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement