#1851

Minimum Interval to Include Each Query

hard· Intervalsruns: 0

You are given a 2D integer array intervals where intervals[i] = [left_i, right_i] describes the inclusive interval [left_i, right_i] of length right_i - left_i + 1. You are also given an integer array queries. The answer to the jth query is the size of the smallest interval i such that left_i <= queries[j] <= right_i. If no such interval exists, the answer is -1. Return an array containing the answers to all queries.

sign in to paste and practice your own solution
desktop only

codedrill is a typing game and needs a real keyboard. open this on a laptop or desktop to practice.

you can still browse problems and sections from your phone.