We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

I agree. I think building a tree from the input stream, combined with the wording of the question really adds to the complexity of this rather basic problem.

It took as much time to get the stdin reading working as it did to do all the previous exercises in this section. The actual 'swap' function was trivial though.

## Swap Nodes [Algo]

You are viewing a single comment's thread. Return to all comments →

I usually agree with Hackerrank's difficulty ratings, however I feel given how tedious this problem is, it should be a "Moderate" at least

I agree. I think building a tree from the input stream, combined with the wording of the question really adds to the complexity of this rather basic problem.

Should be a "Moderate".

solve it for fun why runnning behind "rating" unless you solving it in live competition. Just sayin!

First of all, building a tree is trivial. And second, you don't need to build a tree to solve this. :-)

It took as much time to get the stdin reading working as it did to do all the previous exercises in this section. The actual 'swap' function was trivial though.

True.. The problem is all about an array representation of non binary tree.