maximum product subarray code example Example: max product subarray leetcode Input: [2,3,-2,4] Output: 6 Explanation: [2,3] has the largest product 6.