Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Reddit
Contact us
Hide Buttons

Given an array of numbers, return array of products of all other numbers

Problem

Given an array of n integers, return an array of same size such that prod[i] is equal to the product of all the elements of arr[] except arr[i].

 

Restrictions

 – Not allowed to use division operator

 – Max Time complexity should be O(n)

Example

data = [ 1, 2, 3, 4 ]
prod = [24, 12, 8, 6]

 

Solution

 


 

 

 

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *