Search
⌘K

Leetcode 2865. Beautiful Towers I

Given an array of tower heights where you may only decrease values, reshape it into a mountain (nondecreasing up to one or more equal peak(s), then nonincreasing) to maximize the total sum of heights. The core challenge is, for each candidate peak, to optimally lower elements on both sides (without increasing any) so the sequence is valid and the sum is maximized.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.