LinkedIn interview question

Reverse depth sum