Hudson River Trading: Ball position on a tilting maze after timed tilts
Problem. A board holds a maze and a ball. At any moment the board is tilted up, down, left or right, or lies flat. Each second, if the board is tilted and the next cell in that direction is not a wall, the ball moves one cell that way. You are given the maze, the ball's start, a list of timed tilt events and an end time. Return where the ball is at the end time.
Format. A 30-minute coding round. The interviewer explained the problem verbally and supplied starter code and examples.
Follow-ups.
- Remove repeated code for the four directions by using a direction array.
- Instead of stepping every second from zero, move between consecutive events directly.
What mattered. The candidate's naive simulation worked but they were rejected, which suggests code quality and the faster event-based approach counted.
Comments 0
No comments yet. Ask the author something, or add what happened in your own round.