Solved LeetCode program · 55 of 1,000
#0055 · Jump Game
Original English source
The jumps is a list of 2, 3, 1, 1, and 4. The farthest is 0. The possible is 1.
For every position from 0 to the last position of jumps.
If position is more than farthest, set possible to 0. The arrival is position plus item position of jumps. If position is at most farthest, set farthest to the larger of farthest and arrival.
If possible is 1, display true, otherwise display false.
Expected stdout
true