Article Layout

Asked at AirbnbPhone screen

Reported by the problem's creator, not verified

You are laying out the text of an article as the class ArticleLayout, created with the article's text. The text is words separated by single spaces, and a word is never split across lines.

Examples

  1. Example 1

    Input: init = ["the quick brown fox jumps over the lazy dog"], operations = [["by_line_count",[3]]]

    Output: [["the quick brown","fox jumps over","the lazy dog"]]

    Explanation: At width 14 the greedy lines are the quick, brown fox, jumps over the, lazy dog, which is four lines. At width 15 they are the quick brown, fox jumps over and the lazy dog, which is three, so 15 is the narrowest width and those are the lines.

Import your own questions
Paste a question you were asked and get a full problem: statement, tests and a checked solution.
Import a question

Code

Loading editor…

Ln 1, Col 1

Start an attempt to use Coach.