Wrong answer with input([""],2);


  • 10
    C

    Input: [""], 2

    Output: [""]

    Expected: [" "]

    As described ,the last line of text should be left justified and no extra space is inserted between words.Can anyone explain this?


  • 5
    S

    For the last line of text, it should be left justified and no extra space is inserted between words.

    This means all extra space added to the tail, not between words. In terms of your test case, there should be some demanded space at last.


  • 0
    P

    Your explanation agrees with neither the requirement or the common sense. For the example in the original question, the last line be "justification.", rather than "justification. ", because the count for "between" is 0.


  • 0
    F

    Now the example in the original question is "justification. "


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.