Is the expected result right?


  • 0
    X

    My code got a wrong answer case like this:

    Input: "ABC", 2

    Output: "ABC"

    Expected: "ACB"

    For this case, the zig-zag pattern should be like this:

    A

    B C

    So the out put should be "ABC", is that right?


  • 0
    B

    The output is surely "ACB"


    The zig-zag is like this:

    A C

    B


  • 0
    X

    But why C is in the first line? From my point of view, the second position of first line should be blank, as indicated by the example in the problem description.

    Thanks!


  • 0
    B

    The second position of first line have no need to be blank. another example: "ABCDEFG", 2



    Its zig-zag pattern like this:

    ACEG

    BDF



    In the last line, the next position is 45° to top-right, not 90° to the right.


  • 0
    X

    Oh, I see what you mean...
    Thank you!


Log in to reply
 

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