Google·Software Engineer·Technical Phone Screen
- Given a fixed page width W (in characters) and a string of space-separated words, write a function that counts how many lines are needed to render the text using greedy word wrapping (no breaking words across lines).
- Follow-up: if you have two paragraphs displayed side by side sharing a total width W, how do you find the column split (w1 and w2, where w1 + w2 = W) that minimizes the maximum number of lines across both columns?
“Seemed straightforward and I got through the greedy logic fine.”