#3487

Maximum Unique Subarray Sum After Deletion

pupil · 495 · lc easy +27 · 40.5% accepted · 473 likes · top 20%

Description

Given integer array nums, you may remove any elements (keeping at least one). From the result, choose a contiguous subarray where every element is distinct.

Return the maximum possible sum of such an all-unique subarray.

Code

1
2
3