卷別
資料結構與演算法(A)
選擇國立臺灣大學 2021 · 考試 · 第 2 題
考科演算法
(5 points) A typical dynamic programming example is the snake sequence. Given a grid of numbers, find the maximum length snake sequence. A snake sequence is made up of adjacent numbers in the grid such that for each number, the number on the right or the number below it is or its value. At location , you can move right or move down if that number is . The length of a snake sequence is defined as the number of moves. Given the following grid ( rows, columns; rows top-to-bottom):
9, 6, 5, 2
8, 7, 6, 5
7, 3, 1, 6
1, 1, 1, 7
The maximum LENGTH of snake sequence is?
- (A)6
- (B)7
- (C)5
- (D)4