LinkedIn Interview Question

Leetcode's nested list weight sum-2