Cannot understand a case

  • 0

    For the following case

    My output:
    ["a b","cde"]

    Expected output:
    ["a b","c d","e "]

    I am very curious about this because in the description, it says "For the last line of text, it should be left justified and no extra space is inserted between words." So that "cde" could be placed in the last line.
    Is there anyone who can tell what I miss? Thanks a lot.

  • 1

    Well,each item in ["a","b","c","d","e"] is a word,
    and wherever each interval between two words shall be at LEAST A space.
    So no extra space means a space.
    The last line each interval has one space,but intervals in other lines may include more.

  • 1

    Now I understand. Thanks a lot.

Log in to reply

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