Two Sigma interview question

Debugging question and some tree/recursion question