At every node, we can recursively traverse down the left and right children if they exist, until we reach a leaf.
The difficult part is keeping track of the number of levels.

To do that, we can make the return
statement the number of levels thus far, and increment it by 1 at every step.
This solution has a time complexity O(log n).