Find the contiguous subarray with the largest product using a Kadane-inspired approach.
Constraints
Example
>>> max_product_subarray([2, 3, -2, 4]) 6 >>> max_product_subarray([-2, 0, -1]) 0 >>> max_product_subarray([-2, -3, 4, -1]) 24 >>> max_product_subarray([7]) 7
Recent Submissions
No submissions yet — hit Run Tests to try!
Hints