Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 2420. Find All Good Indices
Find indices i (k <= i < n-k) such that the k elements before i form a non-increasing sequence and the k elements after i form a non-decreasing sequence. Precompute lengths of non-increasing suffixes and non-decreasing prefixes (or equivalent) to test each candidate in O(1), yielding an overall O(n) time and O(n) space solution.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.