Domanda di colloquio di Fiverr Inc.

Product of Array

Risposte di colloquio

Anonimo

16 ago 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).

Anonimo

25 mag 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.