The TransCompilator

Solved LeetCode program · 45 of 1,000

#0045 · Jump Game II

Medium Array chunk-01.md

Original English source

The jumps is a list of 2, 3, 1, 1, and 4. The last is the last position of jumps. The steps is 0. The start is 0. The currentend is 0. The farthest is 0.
Repeat while currentend is less than last.
For every scan from start to currentend, The reach is scan plus item scan of jumps, if reach is greater than farthest, set farthest to reach. Set start to one more than currentend. Set currentend to farthest. Add 1 to steps.

Show steps.

Open in Playground Browse all 1,000 problems

Expected stdout

2