Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Leetcode 353. Design Snake Game
Simulate a Snake game on an m×n grid supporting move(direction): the snake advances, grows when it eats sequentially placed food (increasing score), and the game ends on collision with walls or the snake's own body. Candidates should track the snake body and occupied cells efficiently for frequent moves (e.g., deque + hash set) and handle food lookup and collision checks.
Asked at:
Apple
Atlassian
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Mid November, 2025
Atlassian
Senior
/** * UP, Down, LEFT, RIGHT -> move by 1; * 2D bored * Snake initial size = 3 * Grows by 1 every 5 moves * isover if it hits itself or wall * snakeDirection -- String or int[] {-1,0} - you can decide */
Mid September, 2024
Apple
Senior
Design snake game
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.