Tuesday, December 15, 2015

Products of all numbers in the array

This is google coding interview question:

Given an array of numbers, replace each number with the
product of all the numbers in the array except the number itself *without* using division

https://www.glassdoor.com/Interview/Given-an-array-of-numbers-replace-each-number-with-the-product-of-all-the-numbers-in-the-array-except-the-number-itself-w-QTN_9132.htm

The key to this solution is construct the accessory arrays which assists the solution. Here are the code 


Recursive way


Iterative way:


No comments:

Post a Comment