Data Structures & AlgorithmsHardTCS NQT · Accenture

In the array [1, 4, 2, 6, 5, 7], a value is a record if it is strictly greater than every value before it. What is the sum of all record values?

  1. A. 19
  2. B. 20
  3. C. 22
  4. D. 18

Correct answer: D. 18

Records are 1, 4, 6 and 7; the values 2 and 5 are not records because they are below an earlier maximum.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic