The TransCompilator

Solved LeetCode program · 941 of 1,000

#1306 · Jump Game III

Medium Array chunk-19.md

Original English source

Keep a shared numbers holding 4, 2, 3, 0, 3, 1, and 2. Keep a shared visited as a list of 7 zeros. Keep a shared found of 0.

To seek from spot (a whole number). If spot is less than 0 or spot is more than 6, return. If item spot of visited is 1, return. Set item spot of visited to 1. If item spot of numbers is 0, set found to 1, return. The jump is item spot of numbers. Seek from (spot minus jump). Seek from (spot plus jump).

Seek from 5. If found is 1, show true, otherwise show false.

Open in Playground Browse all 1,000 problems

Expected stdout

true