Jump Game III
Problem Statement
You get an array arr of non-negative integers and a starting index start. From index i you can jump forward to i + arr[i] or backward to i β arr[i]. You can never jump outside the array.
Return true if you can reach any index whose value is 0, and false otherwise.
An array arr and a starting index start.
true if an index holding 0 can be reached from start, otherwise false.
Jump back from index 5 to index 4 (5 β 1), back to index 1 (4 β 3), then forward to index 3 (1 + 2). Index 3 holds 0.
Jump forward from index 0 to index 4 (0 + 4), back to index 1 (4 β 3), then forward to index 3 (1 + 2).
From index 2 you can reach only indexes 0, 2, 3 and 4. None of them holds 0. Index 1, which holds 0, is never reached.
- β’ 1 β€ arr.length β€ 5 Β· 10^4
- β’ 0 β€ arr[i] < arr.length
- β’ 0 β€ start < arr.length
Pattern Recognition Clues
Recognising these key signals in the problem description immediately identifies the pattern:
Approach Complexity Ladder
Recursively try both jumps from each index, and stop any walk after n jumps
Visit each reachable index once, in any order, and check each one for a 0
From index i, try jumping to i + arr[i] and to i β arr[i], recursing on each one that stays inside the array. If an index holds 0, return true. There is no visited set, so an index can be entered again and again. To stop endless back-and-forth, cut a walk off after n jumps.
Recognition rule for this sub-pattern:
Unlock Complete Visual Walkthrough & Optimal C++
The interactive animated dry-run player, optimized C++ implementation, state invariant derivations, and edge-case breakdown for this question are part of Brute2Best Pro. The anchor question of every sub-pattern is completely free.
First anchor question per pattern, Part 1 LLD & Module 1 C++ basics are 100% Free forever.
How this concept connects to System Design & C++ Systems
Top engineering interviews test whether you understand how algorithms like Greedy translate into production architectures and low-level memory mechanics.
Foundations: Object-Oriented Principles in C++23
Class invariants, pure virtual interfaces, and RAII smart pointers.
Food Delivery System (Zomato Architecture)
Real-world machine coding application of algorithms and design patterns.
Pointers vs References Deep Dive
Pointer arithmetic and memory layout under the hood.
Virtual Method Table (vtable) & Memory Layout
Polymorphism, vptr overhead, and multiple inheritance in memory.