Search
⌘K

Leetcode 68. Text Justification

Pack words greedily into lines of exactly maxWidth characters and insert spaces so each line is fully justified. Extra spaces between words must be distributed as evenly as possible with any leftover spaces placed on the leftmost gaps, while the last line (or a line with a single word) is left-justified.

Asked at:

Amazon

Amazon

Coursera

Google

Google


Question Timeline

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

Late November, 2025

Coursera

Senior

Late April, 2025

Amazon

Amazon

Senior

Late November, 2024

Google

Google

Junior

Text Justification

Comments

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