Tap here to switch tabs
Problem
Submissions

Problem: Maximum Erasure Value

med
30 min
Try to solve the Maximum Erasure Value problem.

Statement

Given an integer array nums, you may choose exactly one contiguous subarray whose elements are all distinct. The value of a chosen subarray is the sum of its elements. Return the maximum possible value among all such subarrays.

Constraints:

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

  • 1≤1 \leq nums[i] ≤104\leq 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Erasure Value

med
30 min
Try to solve the Maximum Erasure Value problem.

Statement

Given an integer array nums, you may choose exactly one contiguous subarray whose elements are all distinct. The value of a chosen subarray is the sum of its elements. Return the maximum possible value among all such subarrays.

Constraints:

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

  • 1≤1 \leq nums[i] ≤104\leq 10^4