106. Maximum Product Subarray
MediumDynamic programming
Return the largest product of any non-empty contiguous subarray of the integers nums.
Example 1
Input: nums = [2, 3, -2, 4] Output: 6
Example 2
Input: nums = [-2, 3, -4] Output: 24
Constraints
1 ≤ nums.length ≤ 2 · 10⁴-10 ≤ nums[i] ≤ 10The answer fits in a 32-bit integer