Data Structures & AlgorithmsModerateTCS NQT Digital · Accenture

Problem: The array [1, 4, 6, 3, 8, 2] is processed by a single pass that tracks the maximum so far. How many elements are records (strictly greater than all earlier elements)?

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

Correct answer: B. 4

The records are 1, 4, 6 and 8, the elements that exceed everything before them.

More Coding Interview Problems questions

Exams that ask this topic