DoorDash interview question

Binary Tree problem at screening.