Help with problem: sum of 'powers' of contiguous subarrays modded by a constant value as an int

I'm not sure how to translate the equation into code (I don't even understand the equation to be honest). Please help if you can, thank you!

I'm seeing: Power[l,r] = Min value of subarray [l,r]^i multiplied by sum of [l,r]^i
So given the array below, here's what I'm seeing.
l = 0, r = 0, i = 0 = 1^0x1^0 = 1
l = 0, r = 1, i = 1 = 2^1x5^1 = 10
l = 0, r = 2, i = 2 = 2^2x8^2 = 68
l = 0, r = 3, i = 3 = 1^3x9^3 = 729

So I think I'm reading the equation wrong.

Input: list of ints
Output: sum of 'powers' of contiguous subarrays modded by a constant value as an int
image

powers is defined as:
image

eg input: : [2, 3, 2, 1]
output: 69

Comments (1)