Amazon interview question

Binary tree question and it went well