DSA Key Problems

Text Justification

Given words and a line width, format the words into lines of exactly that width. Distribute spaces across nonfinal lines as evenly as possible with extra spaces in the leftmost gaps, and left-align the final line.