NeetCode #32LC-353MediumArrays & HashingNC Algo100
← Back to All Problems#32 · #353 · Design Snake Game(贪吃蛇游戏)
📌 Problem Statement & Constraints
Design a Snake game on a
width x height grid. The snake starts at (0, 0) with length 1. Food positions are given in advance. Implement move(direction) returning the current score, or -1 if the snake runs into a wall or into itself. Constraints: 1 <= width, height <= 10^4, 1 <= food.length <= 50.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!