solulubeta
Sign in
NeetCode 150 / Intervals
16.06 · Problem

Minimum Interval to Include Each Query

Hard Offline queries + min-heap 1 video LC 1851 Pro

This problem is part of solulu Pro

Each interval [l, r] has size r − l + 1. For each query q, return the size of the smallest interval containing q (l ≤ q ≤ r), or -1 if none does. Answers are in the same order as queries.

Lifetime ₹1,999 ₹999 · Launch offer
Mark this problem as solved when you are finished.

Item 135 of 150 · updated 2026-10-12