Maximum Circular Subarray Product
HardArrayDynamic Programming
Description
Given a circular integer array nums, return the maximum possible product of any non-empty contiguous subarray (wrapping allowed).
Examples
Input:
nums = [2,3,-2,4]Output:
24Explanation:
Circular wrap subarray [4,2,3] gives 24.
Input:
nums = [-1,-2,-3]Output:
6Explanation:
Subarray [-2,-3] gives 6.
Input:
nums = [5,-3,5]Output:
25Explanation:
Circular wrap [5,5] gives 25.
Constraints
- •
1 ≤ nums.length ≤ 200 - •
-10 ≤ nums[i] ≤ 10