Data Structures & AlgorithmsModerateTCS NQT · Infosys

Problem: Intervals [1,4], [3,8], [6,9], [10,12], [2,5] are given. How many of them contain the point 5 (endpoints included)?

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

Correct answer: B. 2

Check each closed interval for containing the point. Endpoints count, so [2,5] qualifies even though 5 is its right end.

More Coding Interview Problems questions

Exams that ask this topic