Search⌘ K
AI Features

Solution: Nested List Weight Sum

C# solution for the Nested List Weight Sum problem using the Tree Depth-First Search pattern.

Statement

Given a nested list nestedList of NestedInteger elements, compute the weighted sum of all integers contained in it.

Each integer contributes its value multiplied by its depth, where the depth of an integer is the number of lists from the outermost list down to the integer. The outermost level has depth 11.

Return the total weighted sum.

Constraints:

  • 11 \leq ...