68. Text Justification

Practice Text Justification for free on NudgeCode: Hard, Array & Hash Table pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

Lay out words into lines of exactly maxWidth characters and return the lines.

Example

words = ["This","is","an","example","of","text","justification."], maxWidth = 16
->  ["This    is    an",
     "example  of text",
     "justification.  "]

Constraints