Both rounds were the interviewer dictating the problem out loud, so I had to take notes — miss one parameter and you're in trouble.
Round 1: a one-dimensional array, N players walking to the right. A watcher starts at an initial position and watches the players. A player being watched can't move. The watcher switches direction according to a given list of timestamps. Given a termination time T, find how many players can reach the end. There were a lot of parameters to keep straight — the length L, the list of player positions, the watcher's starting position, and the (unordered) list of timestamps. It wasn't really testing algorithms, mostly logic, but the time pressure was real.
Round 2: implement itoa() — given a 32-bit signed integer, return its decimal string representation without using any built-in conversion functions. 0 returns "0", negative numbers get a leading '-'. This one comes up a lot on the forum.
Neither round gave me test cases — I had to work out the edge cases myself. I'd expected C++ trivia questions going in, but it turned out to be all implementation problems, so all that trivia prep was wasted.
Discussion
Loading comments…