Data Structures & AlgorithmsHardProduct Company SDE · ICPC regional

Problem: A rope of integer length 10 is cut into integer pieces (at least two pieces), and the product of the piece lengths is maximised. What is that maximum product?

  1. A. 27
  2. B. 36
  3. C. 32
  4. D. 25

Correct answer: B. 36

Use as many 3s as possible but never leave a 1: 10 = 3 + 3 + 4, product 36. Cutting 3 + 3 + 3 + 1 gives 27, five 2s give 32, and two halves give 25.

More Coding Interview Problems questions

Exams that ask this topic