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