Given an integer array nums, find the subarray that has the largest product and return that product.
Unlike maximum sum subarray, a negative × negative pair can
flip the running product back to a large positive. So we can't just track
maxProd — we must also track minProd (the
most-negative running product).
At each index, the new maxProd is the best of three candidates:
nums[i] alone, prevMax × nums[i], or
prevMin × nums[i]. The same three choices determine minProd.
Both are needed simultaneously before updating either.