Nested List Weight Sum (for E4)

Problem Overview

  • Compute the total of all integers in a nested list, where each integer is weighted by its depth level.
  • Input: nestedList of integers or sublists; Output: a single integer sum.
  • Constraints: 1–50 elements, values in [-100, 100], maximum depth ≤ 50.
  • Applies to hierarchical data weighting scenarios (e.g., nested structures).
  • This Meta interviews coding interview problem is a common interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: