Maximum Subarray Sum After One Operation
A medium-tier problem at 65% community acceptance, tagged with Array, Dynamic Programming. Reported in interviews at Sprinklr and 0 others.
Maximum Subarray Sum After One Operation is the kind of medium that looks straightforward until you realize the "one operation" twist breaks your Kadane's algorithm muscle memory. You're allowed to multiply one contiguous subarray by 2, then find the maximum subarray sum across the whole array. Sprinklr has asked it. The problem tests whether you can think beyond standard DP patterns and recognize that the multiplied section doesn't have to overlap with the final subarray you report. Most candidates either try to force the multiplication into the maximum sum directly, or they overthink it into a three-dimensional state space. If this problem hits your live assessment and you blank on the trick, StealthCoder solves it in seconds, invisible to the proctor.
Companies that ask "Maximum Subarray Sum After One Operation"
Maximum Subarray Sum After One Operation is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too.
Get StealthCoderThe key insight is treating this as finding three potential candidates: the max subarray without any multiplication, the max subarray that includes a multiplied section, and the global max across those options. You can't just multiply the max subarray and call it done, because multiplying a negative-sum section by 2 makes it worse, not better. The real trick is running a modified Kadane's variant that tracks two DP states simultaneously: one for subarrays that have already used their multiplication, and one for subarrays that haven't yet. At each position, you decide whether to extend a non-multiplied subarray, start a multiplied subarray, extend an already-multiplied subarray, or reset. The gotcha is that multiplying by 2 is equivalent to adding the subarray to itself, so you're really hunting for the moment where injecting an extra copy of a section yields the global win. StealthCoder surfaces the working DP transition the moment you need it during screen share.
Pattern tags
You know the problem.
Make sure you actually pass it.
Maximum Subarray Sum After One Operation recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Maximum Subarray Sum After One Operation interview FAQ
Is this just Kadane's algorithm with a twist?+
No. Standard Kadane's finds max subarray sum in one pass. Here you need to track whether you've used your multiplication yet and what the best sum is if you multiply a different section entirely. It's DP with branching logic, not a simple greedy scan.
Does the multiplied section have to be part of the final answer?+
No. You could multiply one region to boost your DP state, but the final maximum sum you report might come from a completely different subarray that benefited indirectly or not at all from the multiplication choice.
Why is this a medium and not a hard?+
Because the DP state space is bounded and the number of decisions at each step is small. Acceptance rate of 65% confirms it sits right at medium difficulty. The trick is recognizing the pattern, not implementing complex logic.
Is this still asked at Sprinklr or just historical?+
Sprinklr is the only company reported to have asked it. You won't find it across every FAANG pipeline, but it's real interview data, not a practice-only problem.
What's the time complexity?+
Single pass with constant-time decisions per element means O(n) time and O(1) space if you track only the current and previous DP states. No nested loops, no secondary data structures needed.
Want the actual problem statement? View "Maximum Subarray Sum After One Operation" on LeetCode →