2021-08-31から1日間の記事一覧
一文字づつmapに入れて、後から1文字しか無いものを確認する class Solution { public: int firstUniqChar(string s) { unordered_map<char, int> m; for(int i=0; s.length()>i; i++){ if(m.find(s[i]) != m.end()){ m[s[i]] ++; } else{ m[s[i]]=1; } } for(int i =0;</char,>…