You are given a nested list of integers. Each element is either:
Define the depth of an integer as the number of lists it is inside (top-level integers have depth 1).
Compute the inverse-depth weighted sum:
D
be the
maximum depth
in the structure.
d
has weight
D - d + 1
.
value * weight
over all integers.
isInteger()
,
getInteger()
,
getList()
), or an equivalent representation.
Input: [1, [4, [6]]]
1
at depth 1,
4
at depth 2,
6
at depth 3. Max depth
D=3
.
1*3 + 4*2 + 6*1 = 17
10^4
.