Data Structures & AlgorithmsModerate

Choose three DIFFERENT positions of -10 -3 1 2 7 -1 to maximise the product of their values. What is the maximum product?

  1. A. 210
  2. B. 14
  3. C. 211
  4. D. 209

Correct answer: A. 210

The maximum product of three values is either the three largest values or the largest value times the two most negative ones. Taking only the top three, or pairing the maximum with the wrong two values, misses the second case.

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

Exams that ask this topic