Maximum Product Subarray

Given a nonempty integer array nums, find a nonempty contiguous subarray with the largest product and return that product.

A subarray must consist of consecutive elements of the original array.

##...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: