Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- If you consider the grid as a chequerboard of dark and light squares, then at each step, a snake must move from one colour to the opposite colour.
- Since the start and end points of the snake are on opposite chequerboard colours, any valid snake thus must have even length. Consider this, to better understand the possible values of the snake head and tail.
Add Comment
Please, Sign In to add comment