You are given an integer array nums. Your task is to find the contiguous subarray within the array (containing at least one number) that has the largest product and return that product.
A contiguous subarray is a sequence of adjacent elements.
[2, 3, -2, 4]
6
The subarray [2,3] has the largest product 6.
[-2, 0, -1]
0
The subarray [0] has the largest product 0. Note that the subarray [-2,-1] has product 2, but it's not contiguous with 0, and [0] is a valid contiguous subarray.
[-2, 3, -4]
24
The subarray [-2,3,-4] has the largest product 24.
[2, 3, -2, 4]
6