csco not bad# Stock
l*e
1 楼
You are given a grid of numbers. A snake sequence is made up of adjacent
numbers such that for each number, the number on the right or the number
below it is +1 or -1 its value. For example,
1 3 2 6 8
-9 7 1 -1 2
1 5 0 1 9
In this grid, (3, 2, 1, 0, 1) is a snake sequence.
Given a grid, find the longest snake sequences and their lengths (so there
can be multiple snake sequences with the maximum length).
用dfs的话不太好算最长的sequences 用DP没思路
numbers such that for each number, the number on the right or the number
below it is +1 or -1 its value. For example,
1 3 2 6 8
-9 7 1 -1 2
1 5 0 1 9
In this grid, (3, 2, 1, 0, 1) is a snake sequence.
Given a grid, find the longest snake sequences and their lengths (so there
can be multiple snake sequences with the maximum length).
用dfs的话不太好算最长的sequences 用DP没思路