Array
45. Jump Game II
Treat the array as a graph — from i you can reach anything up to i + nums[i] — and this becomes a shortest-path, which greedy BFS-by-levels solves in one pass. Everything reachable in k jumps forms a…
Loading…
Treat the array as a graph — from i you can reach anything up to i + nums[i] — and this becomes a shortest-path, which greedy BFS-by-levels solves in one pass. Everything reachable in k jumps forms a…
Loading…