Hacker News new | ask | show | jobs
by minimaxir 3715 days ago
Reversing a binary search tree is a binary (pun intended) answer: you either know how to do it because you learned it in college/read Cracking the Coding Interview, or you don't.
3 comments

Is it not obvious that you reverse the left and right subtrees and then swap them?

I learned how to think recursively in college. I never learned how to reverse a binary tree.

What? You do not need to know anything at all. The very wording of this problem is already a solution. No thinking required. No prior knowledge required.
They also teach things like this in boot camps now. The graduates are trained to game these tests because placement rates are so important to boot camps.

Assuming someone is a good programmer because of trivial examples like reversing a binary tree or, worse, writing a bubble sort is like asking someone you to use a wrench to prove that you're an architect.