Tap here to switch tabs
Problem
Submissions

Problem: Maximum Product Subarray

Maximum Product Subarray asks you to find the contiguous subarray of an integer array whose elements produce the greatest product, then return that product. Values may be negative or zero.

Statement

Given an integer array, nums, find a subarray that has the largest product, and return the product.

Constraints:

  • 1≤1\leqnums.length ≤103\leq 10^3

  • −10≤-10\leqnums[i] ≤10\leq 10

  • The product of any prefix or suffix of nums is guaranteed to fit in a 32−bit32-bit integer.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Product Subarray

Maximum Product Subarray asks you to find the contiguous subarray of an integer array whose elements produce the greatest product, then return that product. Values may be negative or zero.

Statement

Given an integer array, nums, find a subarray that has the largest product, and return the product.

Constraints:

  • 1≤1\leqnums.length ≤103\leq 10^3

  • −10≤-10\leqnums[i] ≤10\leq 10

  • The product of any prefix or suffix of nums is guaranteed to fit in a 32−bit32-bit integer.