15% off all plans & roadmaps Use code
See plansProblem editorial
You are given a binary string s, with positions numbered from 0 through s.length - 1. Position 0 is the starting position, and the destination is the final position, s.length - 1. A position is open when its character is '0'; a position containing '1' cannot be landed on.
Jump Game VII is a Sliding Window problem, in the Variable Size (Condition-Based) subpattern. The pattern covers fixed-size, variable-size, and character frequency matching window techniques
The reference solution runs in O(n), where n is s.length. time and O(n) for the reachability array. space.
The full editorial is part of Pro
It explains the core insight, the complexity analysis and the common mistakes, with a worked solution.
Jump Game VII is a Sliding Window problem, in the Variable Size (Condition-Based) subpattern. Once the approach above makes sense, write it yourself and then work through the neighbouring problems that reuse it.