3410. Maximize Subarray Sum After Removing All Occurrences of One Element
You are given an integer array
nums.You can do the following operation on the array at most once:
- Choose any integer
xsuch thatnumsremains non-empty on removing all occurrences ofx.- Remove all occurrences of
xfrom the array.Return the maximum subarray sum across all possible resulting arrays.
A subarray is a contiguous non-empty sequence of elements within an array.