Data Structures & AlgorithmsModerateTCS NQT · Infosys

Sorted arrays [2, 6, 9, 14] and [4, 7, 11, 15] are merged into one list. How many elements of the merged list lie strictly between 5 and 12?

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

Correct answer: B. 4

Merging preserves all eight values, so the answer is a count over the merged sorted list. Bounds are strict, so the values 5 and 12 are excluded even though they are not in the list.

More Coding Interview Problems questions

Exams that ask this topic