First Unique Character in String — Two-Pass Frequency Map [Amazon Easy]
Find the index of the first non-repeating character in a string. Two-pass O(n) solution with a 26-array or HashMap.
webcoderspeed.com
1276 articles
Find the index of the first non-repeating character in a string. Two-pass O(n) solution with a 26-array or HashMap.
Determine if a string is a palindrome considering only alphanumeric characters and ignoring cases. Two pointer O(n) O(1) solution with all 5 language implementations.
Find the longest common prefix string among an array of strings. Covers vertical scan O(n*m), horizontal scan, binary search, and Trie approaches with all 5 language solutions.
Count the number of prime numbers strictly less than n. Master the Sieve of Eratosthenes — one of the most elegant algorithms in CS — with full code in C, C++, Java, JavaScript and Python.
Find the missing number in [0,n]. Two elegant O(n) O(1) solutions: Gauss formula and XOR trick. Full solutions in C, C++, Java, JavaScript and Python.