Leetcode 68. Text Justification
Given an array of words and a maximum line width maxWidth, format the text so that each line has exactly maxWidth characters and is fully justified (left and right aligned). Pack words greedily into lines, then 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. The last line (or a line with a single word) should be left-justified with no extra spaces inserted between words.
Asked at:
Capital One
Anyscale
Amazon
Coursera
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Early July, 2026
Anyscale
Staff
Early April, 2026
Capital One
Senior
Late March, 2026
Capital One
Senior
Hello Interview Premium
Your account is free and you can post anonymously if you choose.