Max Product Subarray

Find the contiguous subarray within an array (containing at least one number) which has the largest product.
Return an integer corresponding to the maximum product possible.

Example :

Input : [2, 3, -2, 4]
Return : 6 

Possible with [2, 3]
Interview Code Editor
Hints
  • Solution Approach
  • Complete Solution
3333 successful submissions.
Asked In:
  • Amazon
  • LinkedIn
  • Microsoft
Click here to jump start your coding interview preparation