2640. Find the Score of All Prefixes of an Array
We define the conversion array
converof an arrayarras follows:
conver[i] = arr[i] + max(arr[0..i])wheremax(arr[0..i])is the maximum value ofarr[j]over0 <= j <= i.We also define the score of an array
arras the sum of the values of the conversion array ofarr.Given a 0-indexed integer array
numsof lengthn, return an arrayansof lengthnwhereans[i]is the score of the prefixnums[0..i].
1 | class Solution { |