// Maximum Product Subarray — MEDIUM
// Category: dynamic-programming
Given an integer array `nums`, find a subarray that has the largest product, and return the product.
The test cases are generated so that the answer will fit in a 32-bit integer.
Hint: Track both the maximum and minimum product ending at each position — a negative minimum can become the new maximum when multiplied by another negative.
Example: nums = [2, 3, -2, 4]
Output: 6