← Back to Difficulty Selection
Code Review (Easy): Perfectly Aligned Logs
Story
Lena noticed that the logs for the team's new deployment tool were jagged and hard to read, so Mark suggested she write a helper to justify the text. She needs to ensure that every line of a message fills a fixed width exactly, distributing extra spaces between words as evenly as she can. Mark reminded her that if a line has only one word or if it’s the very end of the message, it should just stay left-aligned instead of being stretched out. For instance, in a sixteen-character window, the phrase “example of text” should be padded with just enough spaces so the final character of “text” sits flush against the right border.
Your Task
Read the story and code, then decide if the code is ready for production or needs improvement.
Hints
What would block an approval? Give me a hint.
Next
Check out Next Topic: The Dashboard Puddle Problem