Search
⌘K

Leetcode 2439. Minimize Maximum of Array

You can repeatedly move one unit from any element to its immediate left neighbor; find the smallest possible value of the array's maximum after any number of such leftward transfers. Key insight: because mass only moves left, the answer equals the maximum (rounded up) prefix average across all prefixes, so scan prefixes or binary-search with a greedy check.


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.