Недавно я участвовал в конкурсе, на котором меня задавали этот вопрос. Учитывая массив с длинами, какова площадь самого большого прямоугольника, который можно сделать с помощью ВСЕЙ длины. Длины могут быть добавлены, но не разбиты между ними.
Пример:
[ 4,2,4,4,6,8 ]
, учитывая этот массив, мы можем сделать только прямоугольник сторон 8 и 6.
дает площадь 8 * 6 = 48.
Я начинаю и даже после долгого размышления о том, как это сделать, я не могу никуда уйти. Я не ищу решения, но любой ключ, который мог бы подтолкнуть меня в правильном направлении, был бы оценен.
ТИА
Изменить: кто-то указал (комментарий удален сейчас), что его трудно объяснить решение с помощью только намеков и не размещать какой-либо код. Пожалуйста, при необходимости отправьте код.