Skip to content

Commit

Permalink
Time: 23 ms (17.64%) | Memory: 23.8 MB (7.98%) - LeetSync
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimple-01 committed Jun 12, 2024
1 parent 56491a6 commit b9ae888
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions 136-single-number/single-number.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
class Solution {
public:
int singleNumber(vector<int>& nums) {
unordered_map<int,int> mp;
int x;
for(auto & x: nums)
{
mp[x]++;
}
for(auto & y: mp)
{
if(y.second == 1)

return y.first;
}
return -1;

}
};

0 comments on commit b9ae888

Please sign in to comment.