Friday, November 23, 2012
Given an array of integers, populate another array with the product of the elements of the first array except for the current index element.
Subscribe to:
Post Comments (Atom)
Random commentary about Machine Learning, BigData, Spark, Deep Learning, C++, STL, Boost, Perl, Python, Algorithms, Problem Solving and Web Search
1 comment:
int prod = 0;
Reply Deleteforeach(int i : vector) prod *= i;
for (int idx = 0; idx < N; ++idx) {
vector[idx] = prod/vector[idx];
}