Search
⌘K

Leetcode 3248. Snake in Matrix

Simulate the snake moving on an n×n grid (cells labeled row-major as i*n + j) starting at cell 0, applying the sequence of UP/RIGHT/DOWN/LEFT commands and return the final cell index (movement is guaranteed to stay within bounds).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.