Amazon interview question

Given array of numbers [S1, S2, ...Sn], calculate the result array R whose Ri=S1*..S[i-1]*S[i+1]*...*Sn. Require 2 solutions.

Interview Answer

Anonymous

25 May 2012

Let N be the product of all the numbers. Now make an array A[i] = N / S[i].