Fiverr Inc. Interview Question

Product of Array

Interview Answers

Anonymous

Aug 16, 2020

You can go over the array twice: 1. The first time you can calculate the product of all the cells --> save it in a variable productAll 2. Then with a for loop - for every i in range(len(array)): NewArray[i] = productAll/array[i] Then the complexity is of course: O(n).

Anonymous

May 25, 2020

I have been asked to get an array and return an array which in every cell the content is the multiple of the rest of the cells. First I found an easy solution using divide operation, than he asked me to solve it without divide function, I got to the idea but couldn’t solve it completely with my code.