Domanda di colloquio di Datadog

Leetcode question. Easy level problem. Related to binary trees