Home

Maximum Product

Given an integer array nums, find a contiguous non-empty subarray within the array that has the largest product and return the product.

The maximum product subarray is bolded in the sample tests below, but you only need to return its product.

maximumProduct([2, 3, -2, 4]) → 6
maximumProduct([-2, 0, -1]) → 0
maximumProduct([-1, -1, -2, -4]) → 8

😳 TIME LEFT: seconds 😳

function maximumProduct(nums) {

}

TOTAL TIME: seconds