Sponsored
Use these hints if you're stuck. Try solving on your own first.
There are at most 2 possible places where a new node can be inserted?
How can we keep track of the depth of each node?
Solve with full IDE support and test cases