Search
⌘K

Leetcode 2052. Minimum Cost to Separate Sentence Into Rows

Given a sequence of words and a maximum line width, partition the words (in order) into rows to minimize the total penalty where each row incurs a cost based on unused spaces (e.g., squared slack or other badness); the last row may be exempt or handled differently. This is a sequence-partitioning / dynamic programming problem of choosing breakpoints to minimize summed row costs.


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.