Trampoline Run
mediumA gym floor is lined with trampolines. Standing on trampoline i, you can bounce forward to any trampoline up to bounce[i] positions ahead (including staying put if bounce[i] is 0 — which strands you).
You start on the first trampoline. Return True if you can reach the last trampoline, False otherwise.
Example 1
in bounce = [2, 3, 1, 1, 4]
out True
Bounce 0 → 1 (power 3), then 1 → 4. Done.
Example 2
in bounce = [3, 2, 1, 0, 4]
out False
Every route funnels into index 3, whose power is 0 — you're stranded short of the end.
Constraints
- · 1 <= len(bounce) <= 10^4
- · 0 <= bounce[i] <= 10^5
solution.py● loading python…
test results
Hit ▶ Run to test your code against the visible cases.