Skip to content

Latest commit

 

History

History
19 lines (14 loc) · 419 Bytes

24.md

File metadata and controls

19 lines (14 loc) · 419 Bytes
 int firstUniqChar(string s) {
        vector<int> freq(26);

        for(auto i: s)
            freq[i-'a']++;

        for(int i=0;i<s.size();i++)
        {
            if(freq[s[i]-'a']==1)
                return i;
        }

        return -1;
    }