Concept Flow - Maximum Product Subarray
Start at index 0
Initialize maxProd, minProd, result
For each element from index 1 to end
If element < 0, swap maxProd and minProd
Update maxProd = max(element, maxProd * element)
Update minProd = min(element, minProd * element)
Update result = max(result, maxProd)
Repeat until end
Return result
We move through the array, tracking the maximum and minimum products ending at each position, swapping when negative numbers appear, and keep the highest product found.
