Posted on June 22, 2021June 22, 2021 Description Submission class Solution { int freq[26]; public: int firstUniqChar(string s) { for(char ch: s) { ++freq[ch-'a']; } for(int i = 0; i < s.length(); ++i) { if(freq[s[i]-'a'] == 1) return i; } return -1; } }; By Bill0412 Easy LeetCode