Practice Odd Even Jump
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
A jump from i must go to a larger index. On odd-numbered jumps, choose the smallest value at least arr[i]; on even-numbered jumps, choose the largest value at most arr[i]. Break equal-value ties by choosing the smallest destination index. If no permitted destination exists, that path stops. Starting with an odd jump, count indices from which the final array index is reachable. The final index itself qualifies with zero jumps.
Source: Odd Even Jump on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
arr = [10,13,12,14,15]
2
# Example 2
arr = [2,3,1,1,4]
3
# Example 3
arr = [5,1,3,4,2]
3
Constraints
Related LeetCode Problems
Practice more problems similar to Odd Even Jump.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.