Amazon Interview Question

How would you find the first non-repeating character in a string

Interview Answer

Anonymous

Dec 30, 2024

To solve this, I’d use a hash map to store the frequency of each character: 1. Traverse the string and count the occurrences of each character using a hash map. 2. Iterate through the string again and check the hash map for the first character with a count of 1.