The Google L4 Coding Round I Bombed

Four questions from the L4 coding round I failed in 2023, with the exact follow-ups my interviewer pushed me on. Each entry shows the answer I wish I had given, plus the simpler one I missed.

Question Bundle
Python
interview-prep
google
algorithms
ezb1981

By @ezb1981

January 11, 2026

·

Updated May 20, 2026

815 views

18

4.2 (12)

Return the index of the first non-repeating character in a string, or -1 if none exists. The interviewer asked for a single pass plus a single pass, no built-in Counter. Hint: I overengineered this with two dictionaries.

What I should have written

first_unique_char('leetcode') returns 0 ('l' is the first single). first_unique_char('aabb') returns -1 (everything repeats). first_unique_char('loveleetcode') returns 2 ('v' is the first with count 1).

3 more questions and all solutions are locked.

Purchase this item to access all questions, code snippets, and solutions.