Question d’entretien chez Amazon

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.

Réponse à la question d'entretien

Utilisateur anonyme

25 mai 2012

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