widths[0] is the width of a, widths[1] the width of b, and so on.
The text text is laid out letter by letter from left to right: the next letter goes on the current line if the line stays within 100 pixels afterwards. Otherwise a new line starts and the letter becomes its first. There is no word wrapping; only letters matter.
Return a list of two numbers: how many lines the text takes and how wide the last line is in pixels.widths=[20, 30, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10], text="abbac" → [2, 10]
a, b, b take 20 + 30 + 30 = 80 pixels; the next a (20) still fits, filling exactly 100. The letter c moves to a second line, which is 10 pixels wide.
widths=[5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], text="hello" → [1, 25]
Five letters of 5 pixels each make one line 25 pixels wide.
text consists of lowercase English letterswidths=[20, 30, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10], text="abbac"
[2, 10]
Run checks the first 3 tests in your browser. Submit checks all 48 tests on the server, hidden ones included.