Implement a function to calculate the longest snake of ones that can be made from a starting
Fantastic news! We've Found the answer you've been seeking!
Question:
Implement a function to calculate the longest "snake" of ones that can be made from a starting position in a grid. A snake is made by moving right and down from a starting position as far as possible.
- Assumption: grid will be at least Ix', row and col will each be valid indexes in grid
- Restrictions: You may not use the max() or .in() functions.
- Examples: (cells is a 2D list below)
- Snake(cells,0,0) ? 1 # can't move in either direction
- Snake(cellS,0,2) ? 2 # can o down one, then no more moves
- Snake(cells,1,1) ? 5 # all he way down, and then right
Related Book For
Posted Date: