Given an integer array nums, find a subarray that has the largest product, and return the product.
Input: nums = [2,3,-2,4]
Output: 6
Explanation: [2,3] has the largest product 6.
Topics: arrays, dp
Asked by: Amazon, Google, Microsoft
Time complexity: O(n). Space complexity: O(1).