Shyplite interview question

binary tree question from frontend to backend