Concept Flow - Maximum Product Subarray
Start
Initialize maxProd, minProd, result with first element
For each element from second to end
Calculate candidates: current element, maxProd*current, minProd*current
Update maxProd = max of candidates
Update minProd = min of candidates
Update result = max(result, maxProd)
Repeat until end
Return result
We scan the array once, keeping track of the maximum and minimum products ending at each position, updating the result with the highest max product found.
