arrow_back Back to Challenges

#152 Maximum Product Subarray

Medium Acceptance 0%
description

Problem Description

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.

checklist Constraints

1 <= nums.length <= 2 * 10^4
-10 <= nums[i] <= 10
The product of any prefix or suffix of nums is guaranteed to fit in a 32-bit integer.

science Examples

Case #1

In: nums = [2,3,-2,4]
Out: 6

Case #2

In: nums = [-2,0,-1]
Out: 0

Mastery Tags

Arrays Dynamic Programming

Hiring Companies

Amazon Bloomberg Google
code

Integrated IDE

code_blocks
Coding
psychology
Aptitude