152. Maximum Product Subarray

Practice Maximum Product Subarray for free on NudgeCode: Medium, Dynamic Programming pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

Return the largest product of a non-empty contiguous subarray of nums.

Example

nums = [2,3,-2,4]  ->  6   ([2,3])
nums = [-2,0,-1]   ->  0

Constraints