# Session 3 Given an array of strings and a number, reflow the lines of the text based on the given length. Input ```python= lines = ['It was the best', 'of times it was', 'the worst of times'] length = 8 length = 12 ``` Output ``` length = 8 It was the best of times it was the worst of times length = 12 It was the best of times it was the worst of times ``` Make sure to practice the **[UMPIRE method](https://hackmd.io/@zXKevDKYS9a3T9goj4clQA/S1CaDzIiV?type=view)**! :::spoiler 1. **Understand** Ask clarifying questions and use examples to understand what the interviewer wants out of this problem Choose a “happy path” test input, different than the one provided, and a few edge case inputs. Verify that you and the interviewer are aligned on the expected inputs and outputs. 2. **Match** See if this problem matches a problem category (e.g. Strings/Arrays) and strategies or patterns within the category 3. **Plan** Sketch visualizations and write pseudocode Walk through a high level implementation with an existing diagram 4. **Implement** Implement the solution (make sure to know what level of detail the interviewer wants) 5. **Review** Re-check that your algorithm solves the problem by running through important examples Go through it as if you are debugging it, assuming there is a bug 6. **Evaluate** Finish by giving space and run-time complexity Discuss any pros and cons of the solution ::: **Python** <iframe height="600px" width="100%" src="https://repl.it/@membriux/codepath-practice-session3-python?lite=true" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>