[LeetCode] Maximize Subarray Sum After Removing All Occurrences of One Element

1 · · Jan. 5, 2025, 5:38 a.m.
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 x such that nums remains non-empty on removing all occurrences of x. Remove all occurrences of x from 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. ...