LinkedIn interview question

Depth sum for nested numbers