Question d’entretien chez DoorDash

Binary Tree problem at screening.