Search
⌘K

Leetcode 2866. Beautiful Towers II

Choose heights within [1, maxHeights[i]] that form a mountain (nondecreasing to a single peak then nonincreasing) to maximize the total sum. Core challenge: for each possible peak, compute the best feasible left/right height profiles under the monotonic constraints (commonly done with prefix/suffix scans or monotonic stacks) and take the maximum total.

Asked at:

Bloomberg

Bloomberg


Question Timeline

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

Mid September, 2025

Bloomberg

Bloomberg

Mid-level

https://leetcode.com/problems/beautiful-towers-ii/

Comments

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