You are viewing a single comment's thread. Return to all comments →
My algorithm is the same as yours,but i did not pass all the test.
Yeah, same here. I only passed some tests. I wonder what we're doing wrong...
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
It was after i passed 2 out of 3 test that i re-read the problem definition and understood this.
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
Swap Nodes [Algo]
You are viewing a single comment's thread. Return to all comments →
My algorithm is the same as yours,but i did not pass all the test.
Yeah, same here. I only passed some tests. I wonder what we're doing wrong...
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
It was after i passed 2 out of 3 test that i re-read the problem definition and understood this.