Confused by the example


  • 0
    T

    "This", "is", "an", "example", length = 15 (4+2+2+7) < 16
    why output is

    [
    "This is an",
    "example of text",
    "justification. "
    ]


  • 0
    M
    This- -is- -an- -example
      4  1 2  1  2 1  7
    

    4+1+2+1+2+1+7 = 18 > 16

    Spaces are counted in the length of the line, but you aren't counting them in your approach.


Log in to reply
 

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