At Spotify, you are given a lowercase string s and need to find the index of the first character that appears exactly once. If no such character exists, return -1.
s containing only lowercase English letters.-1 if every character repeats.Example 1
s = "leetcode"0'l' appears once and is the first such character.Example 2
s = "loveleetcode"2'v' is the first character with frequency 1.Example 3
s = "aabb"-11 <= len(s) <= 10^5s contains only lowercase English lettersA correct solution should run efficiently for large strings. A common approach is to count character frequencies first, then scan the string again to find the first index whose count is 1.