Tap here to switch tabs
Problem
Submissions

Problem: Maximum Subarray Sum After One Operation

Try to solve the Maximum Subarray Sum After One Operation problem.

Statement

You are given an integer array nums. You must perform an operation exactly once by choosing an index i and replacing nums[i] with nums[i] * nums[i].

Return the maximum possible sum of a contiguous non empty subarray after applying this operation.

Note: A subarray is a contiguous sequence of elements within an array.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • −104≤-10^4 \leq nums[i] ≤104\leq 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Subarray Sum After One Operation

Try to solve the Maximum Subarray Sum After One Operation problem.

Statement

You are given an integer array nums. You must perform an operation exactly once by choosing an index i and replacing nums[i] with nums[i] * nums[i].

Return the maximum possible sum of a contiguous non empty subarray after applying this operation.

Note: A subarray is a contiguous sequence of elements within an array.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • −104≤-10^4 \leq nums[i] ≤104\leq 10^4