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.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.