Maximum Product Subarray — track max and min
A running product can swing wildly: a negative number turns the smallest product into the largest. So carry both the max and the min ending here, and swap roles as signs flip.
Try:
← Prev
Next →
▶ Play
Reset
max ending here
0
min ending here
0
best overall
0