Search
⌘K

Leetcode 3301. Maximize the Total Height of Unique Towers

Given per-tower upper bounds, assign each tower a unique positive integer height not exceeding its maximum to maximize the total sum (return -1 if impossible). The core challenge is choosing distinct values under individual caps — typically solved by sorting the maxima and greedily assigning the largest feasible distinct heights in decreasing order.


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.