Pregunta de entrevista de Revolut

LeetCode question with binary trees.