employer cover photo
employer logo

Pergunta de entrevista da empresa Altera

Given two integer arrays, write a function which can compute the product of first array and save in the second array, except the product of that particular element from first array of same index you currently store in second array. A = [a(0), a(1), a(2), a(3) ... a(n)] B = [b(0), b(1), b(2), b(3) ... b(n)] where b(0) = a(1) x a(2) x a(3) .... x a(n) b(1) = a(0) x a(2) x a(3) .... x a(n) . . . b(n) = a(0) x a(1) x a(2) .... x a(n-1)

Resposta da entrevista

Sigiloso

15 de abr. de 2016

Take the product of all elements of the first array, and divide it with each element later later as you store in second array. It will run N+N times.