Algorithm · Meta · Medium
Problem: Weighted Nested-List Sum Given a nested integer list named nestedList, compute its weighted sum. An integer's weight is its nesting depth: the more deeply a value is nested, the larger its weight. The outermost level is depth 1. Example 1: Input: [[1,1],2,[1,1]] Output: 10 Explanation: Each 1 is at depth 2 and therefore contributes 12; there are four such values. The 2 is at depth 1, so the total is 12+12+21+12+12=10. Example 2: Input: [1,[4,[6]]] Output: 27…
Checking your access…