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