Maximum Product Subarray
Given an integer array nums, find the contiguous subarray within the array that has the largest product, and return the product.
This problem asks for the contiguous subarray with the maximum product in an integer array. Because negative numbers and zero can dramatically change the product, the key is to track both the maximum and minimum product ending at each position. When a negative number appears, the current maximum and minimum can swap roles, and a zero effectively resets the running product. The final answer is the best product seen during the scan.