Compass Interview Question

Given a long string and a character limit, write a function that would return an array of strings with the text justified -- account for all edge cases (last line, proper spaces between strings, etc.)