Blackhawk Network interview question

LC hard question about binary tree