Data Structures & AlgorithmsModerateTCS NQT · Accenture

Problem: A sparse-table-free query: over the array [5, 2, 8, 1, 9, 3, 7], what is the minimum value on the range of indices [2, 5] (inclusive)?

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

Correct answer: C. 1

A range minimum over an inclusive index range. Using the exclusive upper bound 5 misses index 5 and gives a larger value.

More Coding Interview Problems questions

Exams that ask this topic