Data Structures & AlgorithmsHardCodeforces Div2 B · TCS NQT

What is the maximum product of THREE distinct elements of [-10, -3, 1, 5, 2, -8, 4] (chosen by position)?

  1. A. 40
  2. B. 400
  3. C. 360
  4. D. 125

Correct answer: B. 400

Sorting gives two candidates: the three largest, or the two most negative times the largest. Taking only the three largest misses the case where two large negatives multiply to a large positive.

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

Exams that ask this topic