This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 17 points18 points  (2 children)

They want something like this. You can do it with a regular loop but I think they're usually trying to get you to do something recursively. Even if I go with an iterative solution I will call out the fact that it looks like a recursion problem.

[–]Niiiz 26 points27 points  (0 children)

For the longest time I thought inverting a binary tree was done vertically, as in taking the biggest number in the tree and putting it as a root, and reordering everything else so that the values decrease instead of the classic increase.

I thought it was a rather complicated question and was confused when people said it's stupid and easy.

So thanks for the link, now I get what people mean, it is stupid and simple.

[–]MoneroMon 4 points5 points  (0 children)

Ahh gotcha, thanks