Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 1851. Minimum Interval to Include Each Query
For each query, return the length of the smallest interval [left, right] that contains the query (right - left + 1), or -1 if none exists. With up to 10^5 intervals/queries this requires an O(n log n) approach—typically sorting and using a priority structure to maintain candidate intervals by size.
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.