cswork / OA打开练习工作台

MicrosoftOA #25

Frog Game

估计中等评测数据准备中,可先阅读题面

考点(AI 标注)双指针滑窗动规入门

Given an array blocks where each cell represents the height o

Constraints

N/A

Example 1

Input:

blocks = [9,2,5,3,0]

Output:

2

Explanation: Let the two frogs start on cell 4 and one of them go to cell 2. (There is another option here that will give you 2).

Example 2

Input:

blocks = [1,2,3,4,5,8]

Output:

6

Explanation: If both frogs start at cell 5.