Frage im Vorstellungsgespräch bei Datadog

Leetcode question. Easy level problem. Related to binary trees