NeetCode #847LC-1851HardIntervalsNC 150NC 250
← Back to All Problems

#847 · #1851 · Minimum Interval to Include Each Query(包含每个查询的最小区间)

📌 Problem Statement & Constraints

You are given a 2D array intervals, where intervals[i] = [left, right], and an array queries. For each query q, find the length of the smallest interval containing q (i.e. left <= q <= right), or -1 if no interval contains it. Return an array of answers in the original query order. Constraints: 1 <= intervals.length, queries.length <= 10^5, 1 <= left <= right <= 10^7, 1 <= queries[i] <= 10^7.
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!