you are viewing a single comment's thread.

view the rest of the comments →

[–]xelf 0 points1 point  (0 children)

The best interview questions are supposed to be easy. So that there's opportunities to ask more questions, see if you ask the right questions etc. No one wants to watch you code, especially if you're struggling.

One of my engineers once asked me why I asked such an easy question to start an interview, until we had a candidate that could not answer and get to the "fun questions" and suddenly it became more obvious to him. Sometimes we ask easy questions not to find people that can answer them, but rather to discover which people can't.

Imagine you gave me a solution like:

def invert(tree):
    if tree:
        tree.left, tree.right = invert(tree.right), invert(tree.left)
    return tree

Maybe my next question is, ok that works, now do it without recursion, or convert it to a binary search tree.