Write better code: Day 2 - Product of every integer
Arjun Rajkumar Dec 5 Updated on Dec 07, 2018
I'm going to spend 1-2 hours/day solving different algorithms. More about this here.
You have an array of integers, and for each index you want to find the product of every integer except the integer at that index.
Write a method get_products_of_all_ints_except_at_index() that takes an array of integers and returns an array of the products.
For example, given:
[1, 7, 3, 4]
your method would return:
[84, 12, 28, 21]
[7 * 3 * 4, 1 * 3 * 4, 1 * 7 * 4, 1 * 7 * 3]
Here's the catch: You can't use division in your solution!
If you want to follow along, feel free to post your answers below.