Search⌘ K
AI Features

Solution: Maximum Erasure Value

C# solution for the Maximum Erasure Value problem using the Sliding Window pattern.

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:

  • 11 \leq nums.length 105\leq 10^5 ...