Find product of every integer except integer at that index
This one is also popular question to check candidate ability to write algorithm quick within an hour during first round of screening interview.
Question: You have a list of integers, and for each index you want to find the product of every integer except the integer at that index.
Write a function get_products_of_all_ints_except_at_index() that takes a list of integers and returns a list of the products.
For example, given:
[1, 7, 3, 4]
your function would return:
[84, 12, 28, 21]
[7*3*4, 1*3*4, 1*7*4, 1*7*3]
Solution: While there are many ways you could do this I found below two ways to do it: