class Solution
{
public:
vector<int> singleNumber(vector<int> nums)
{
map<int,int>mp;
for(int i=0;i<nums.size();i++)
{
mp[nums[i]]++;
}
vector<int>v;
map<int,int>::iterator it;
for(auto it:mp)
{
if(it.second==1) v.push_back(it.first);
}
return v;
// Code here.
}
};
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter