Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public:
- int firstUniqChar(string s) {
- unordered_map<char, int> mp;
- for (auto a : s) mp[a]++;
- for (int i = 0; i < s.size(); i++)if(mp[s[i]] == 1)return i;
- return -1;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement