• + 1 comment

    My algorithm is the same as yours,but i did not pass all the test.

    • + 1 comment

      Yeah, same here. I only passed some tests. I wonder what we're doing wrong...

      • + 1 comment

        you're probably missing the bit where if k=2, then you have to swap children at depth =2, depth =4, depth=6 and so on

        • + 0 comments

          It was after i passed 2 out of 3 test that i re-read the problem definition and understood this.