diff --git a/136-single-number/single-number.cpp b/136-single-number/single-number.cpp new file mode 100644 index 0000000..a91f56c --- /dev/null +++ b/136-single-number/single-number.cpp @@ -0,0 +1,19 @@ +class Solution { +public: + int singleNumber(vector& nums) { + unordered_map mp; + int x; + for(auto & x: nums) + { + mp[x]++; + } + for(auto & y: mp) + { + if(y.second == 1) + + return y.first; + } + return -1; + + } +}; \ No newline at end of file