Data Structures & AlgorithmsVery hardProduct company OA · Amazon/Microsoft-style OA

Half-open intervals [0,4), [3,7), [6,9), [8,12). How many unit cells [x, x+1) are covered by two or more intervals?

  1. A. 5
  2. B. 2
  3. C. 4
  4. D. 3

Correct answer: D. 3

Count cells where the coverage count is at least two. Each interval contributes its length, so the total coverage exceeds the union; the excess over the union is not the same as the doubly-covered cells.

More Coding Interview Problems questions

Exams that ask this topic