cswork / OAOpen practice workspace

MicrosoftOA #25

Frog Game

Estimated MediumStatement and editorial — judging is being prepared

Topics (AI-labelled)Two PointersDP Basics

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.

Editorial

Loading solution…