Data Structures & AlgorithmsHard

For each contiguous subarray of 4 2 7 1 5 3 6 2, locate the FIRST position (in the original array) where its minimum value occurs. How many subarrays have that position at an ODD index?

  1. A. 32
  2. B. 4
  3. C. 16
  4. D. 33

Correct answer: A. 32

Use the absolute index of the first minimum within the subarray, not its relative position, since the question is about the array index. Using the relative position, or the even-index count, gives different totals.

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

Exams that ask this topic