Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Keep track of the prefix maximum of the array
Establish a relationship between ans[i] and ans[i-1]
for 0 < i < n, ans[i] = ans[i-1]+conver[i]. In other words, array ans is the prefix sum array of the conversion array