Tap here to switch tabs
Problem
Submissions

Problem: Find the Score of All Prefixes of an Array

Try to solve the Find the Score of All Prefixes of an Array problem.

Statement

We define the conversion array conver of an integer array nums such that conver[i] = nums[i] + max(nums[0...i]), where max(nums[0...i]) is the maximum value among the elements of nums from index 00 to index i.

The score of a prefix of nums ending at index i is the sum of all values in conver from index 00 to index i.

Given an integer array nums, return an array ans of the same length where ans[i] represents the score of the prefix of nums ending at index i.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the Score of All Prefixes of an Array

Try to solve the Find the Score of All Prefixes of an Array problem.

Statement

We define the conversion array conver of an integer array nums such that conver[i] = nums[i] + max(nums[0...i]), where max(nums[0...i]) is the maximum value among the elements of nums from index 00 to index i.

The score of a prefix of nums ending at index i is the sum of all values in conver from index 00 to index i.

Given an integer array nums, return an array ans of the same length where ans[i] represents the score of the prefix of nums ending at index i.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤109\leq 10^9