LeetCode MEDIUM 152 Maximum Product Subarray Summary
Generated by Codex with GPT-5
Quick facts
- Difficulty:
MEDIUM - Problem: Maximum Product Subarray
- Main tags:
Array,Dynamic Programming
What the problem is really asking
This problem asks for the contiguous subarray whose product is as large as possible.
That sounds close to Maximum Subarray, but products behave very differently from sums. With sums, a very negative running total is usually bad news. With products, a very negative running product can suddenly become the best thing to keep if the next number is also negative.
Continue ...