Can you Anyone solve this problem...
There is given one array lets say Arr[n]( n is the size of array). You have to store multiplication of all elements of Arr[n] except element Arr[i] into a array OutVar[i]. Example:
Code:
Suppose given am array as
Arr[5]={1,2,3,4,5}
Then
OutVar[0]=Arr[1]*Arr[2]*Arr[3]*Arr[4]
OutVar[1]=Arr[0]*Arr[2]*Arr[3]*Arr[4]
OutVar[2]=Arr[0]*Arr[1]*Arr[3]*Arr[4]
OutVar[3]=Arr[0]*Arr[1]*Arr[2]*Arr[4]
OutVar[4]=Arr[0]*Arr[1]*Arr[2]*Arr[3]*
Condition Apply: 1. Time Complexity should be O(n) (No matter for space better If you
minimize space also)
2. Division(/) or Modular division(%) are not allowed.