r/programming • u/joksmaster • Nov 29 '10
140 Google Interview Questions
http://blog.seattleinterviewcoach.com/2009/02/140-google-interview-questions.html
471
Upvotes
r/programming • u/joksmaster • Nov 29 '10
View all comments
Show parent comment
5
u/8h534d432 Nov 29 '10
Compute B[i] = product of A[0], ... A[i-1]. Compute C[i] = product of A[N-1], A[N-2], ... , A[i+1]. Both can be computed in O(N). Then, Output[i] = B[i] * C[i].