Skip to content

Latest commit

 

History

History
15 lines (11 loc) · 525 Bytes

002_productofallothernumbers.md

File metadata and controls

15 lines (11 loc) · 525 Bytes

Product of All Other Numbers

[Date]

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 should return: [84, 12, 28, 21]
By calculating: [7 * 3 * 4,  1 * 3 * 4,  1 * 7 * 4,  1 * 7 * 3]

Here's the catch: You can't use division in your solution!