Skip to content

Latest commit

 

History

History

Maximum Product Subset of an Array

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Given an array a, we have to find maximum product possible with the subset of elements present in the array. The maximum product can be single element also.

Input       :   { -1, -1, -2, 4, 3 }
Output      :   24
Explanation :   Maximum product will be ( -2 * -1 * 4 * 3 ) = 24

Input       :   { -1, 0 }
Output      :   0
Explanation :   0(single element) is maximum product possible

Input       :   { 0, 0, 0 }
Output      :   0