← ALL NOTES
Array

1695. Maximum Erasure Value

Find the maximum sum of a subarray with all unique elements. A sliding window keeps a set of the current elements and a running sum, shrinking from the left when a duplicate appears.

Loading…