Amazon (Audible) - 2022 | phone interview | first unique character in a string + zigzag traversal
Summary
I had a 1-hour phone interview with Amazon (Audible) in 2022, which included two coding questions. I solved the first one easily, but struggled with the second, despite having seen it before.
Full Experience
I recently experienced a 1-hour phone interview with Amazon (Audible) in 2022. The interview consisted of two coding challenges. I found the first question to be quite straightforward and solved it without much difficulty. However, the second question was familiar to me from prior practice, but I unfortunately forgot the specific approach involving a deque during the interview and was unable to provide a correct answer.
Interview Questions (2)
First Unique Character in a String
Given a string s, find the first non-repeating character in it and return its index. If it does not exist, return -1.
Binary Tree Zigzag Level Order Traversal
Given the root of a binary tree, return the zigzag level order traversal of its nodes' values. (i.e., from left to right, then right to left for the next level and alternate between). The solution should return a list of lists where each inner list represents a level's values in zigzag order.