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
Coursera
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Late November, 2025
Coursera
Senior
Late April, 2025
Amazon
Senior
Late November, 2024
Junior
Text Justification
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.