Can someone explain to me what is ZigZag?


  • 4
    B

    I'm not quite understand what is ZipZag means in this question. For example, what are rules to generate the ZipZag format of a String, what the pattern looks like when there are 4 rows, 5 rows, etc.


  • 0
    H

    imagine you are drawing the letter Z


  • 18
    S

    string s = "abcdefghijklmn", numRows = 4

    a           g           m
      b       f   h       l   n
        c   e       i   k
          d           j
    

    Also, u can write them in the following way, cuz there's no difference if u put all characters in a string row by row:

    a   g   m
    b f h l n
    c e i k
    d     j
    

    I do prefer the first one, cuz it's much easier to understand.
    I hope this may help u :)


Log in to reply
 

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