Get started with 60 Hours of Free course right now 

Product of all sub arrays

Kopal Jaiswal
16 Posts

WAP to find the product of all subarrays of an array

Example 1:

Input: {2,5}

Output: 100

Subarrays are {2}, {5}, {2,5}

Product is 2*5*10=100

 

Example 2:

Input: {3,6,8}

Output: 8957952 

Subsets are {3}, {6}, {8}, {3,6}, {6,8}, {3,8}, {3,6,8}

Product is 3*6*8*18*48*24*144 =8957952

Published By : Kopal Jaiswal
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Comments