Skip to main content
Maximum Product Subarray | AlgoCracked
AlgoCracked
ProblemsMaximum Product Subarray
Medium35.0% acceptance
Blind75Dynamic ProgrammingArray

Maximum Product Subarray

Given an integer array nums , find the contiguous non-empty subarray whose elements multiply to the largest product , and return that product. Because negatives flip the sign of a running product, a large negative product can become the best answer the moment another negative is seen. Input format Input is a single array, e.g. [[2,3,-2,4]] .

Loading workspace…