217. Contains Duplicate (Leetcode)

PHOTO EMBED

Mon Oct 04 2021 12:09:28 GMT+0000 (UTC)

Saved by @Sakshamkashyap7 #c++

class Solution {
public:
    bool containsDuplicate(vector<int>& nums) {
        unordered_set<int>st(nums.begin(), nums.end());
        cout<<nums.size()<<"  "<<st.size()<<endl;
        return (nums.size() == st.size()) ? false : true; 
    }
};
content_copyCOPY

check any duplicate in array

https://leetcode.com/problems/contains-duplicate/