#3410
Maximize Subarray Sum After Removing All Occurrences of One Element
international master · 2150 · lc hard +32 · 22.9% accepted · 60 likes · top 3%
Description
You are given an integer array nums.
Optionally perform at most one operation: choose an integer x such that removing every occurrence of x leaves nums non-empty, then remove all occurrences of x.
Return the maximum subarray sum across all possible resulting arrays.
Code
1
2
3