Data Structures & AlgorithmsHardCodeforces Div2 B-D · ICPC regional

What is the minimum number of elements of [1, 3, 2, 5, 4, 6] that must be changed (values may be set arbitrarily) so that the array becomes strictly increasing?

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

Correct answer: A. 2

Unchanged elements must form a strictly increasing subsequence; the longest one here has length 4 (for example 1, 2, 4, 6), so 2 changes are needed.

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

Exams that ask this topic