Let the given sentence be: [ “what”, “must”, “be”, “shall”, “be.”]
And L=12.
The justified output will be :
[ “what must be”
“Shall be.” ]
Note that the last line is only left justified.
The first line of input contains an integer ‘T’ representing the number of test cases. Then the test cases follow.
The first line of each test case contains a single integer ‘n’ denoting the number of words in the sentence.
The second line of each test case contains space separated strings denoting the word in the sentence. Note that no word has space in between it.
The third line of each test case contains the integer ‘L’ denoting the number of characters in each line in the justified output
For each test case, return an array of strings denoting the justified output of the given sentence.
The output for each test case is in a separate line.
1. You do not need to print anything; it has already been taken care of.
2. The words do not contain whitespaces.
3. It is guaranteed that L is always greater than the number of characters in any of the given words in the given array ‘words’
Missing Number
Longest Subarray With Zero Sum
Merge Two Sorted Arrays Without Extra Space
Ninja And The Strictly Increasing Array
Negative To The End