Smallest Set Covering Intervals

Problem Overview

  • Find the minimum size of a set of integers such that each interval contains at least two integers from the set.
  • Input: arrays first[i] and last[i] defining n intervals; Output: an integer for the smallest set size; Constraints: 1 ≤ n ≤ 1e5, 0 ≤ first[i] ≤ last[i] ≤ 1e9.
  • Context: interval coverage and resource scheduling, relevant to database partitioning and query optimization.
  • From Snowflake interviews; a coding interview problem and common interview question on interval selection.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: