Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Leetcode 975. Odd Even Jump
Count how many starting indices can reach the end of an array by alternating odd/even jumps where an odd jump goes to the smallest-index j>i with arr[j] >= arr[i] and an even jump goes to the smallest-index j>i with arr[j] <= arr[i]. The core challenge is efficiently precomputing these next-higher/next-lower targets (e.g., via sorting + monotonic stack or an ordered map) and using DP to track which indices can reach the end.
Asked at:
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Early November, 2024
Mid-level
Array Jumping: Given an integer array A of size N, implement a function that returns the number of starting points from which you can reach the end of the array by jumping according to specific odd and even jump rules.
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.