Maximum Product Subarray · Compound Engineer

Maximum Product Subarray

Find the contiguous subarray with the largest product. A negative number can turn the smallest product into the largest, so track both the maximum and the minimum product ending at each index.

DSAProMediumStep-through playerBy Aayush OstwalSolve on LeetCode ↗
Spotted a mistake in this lesson?Report an issue →