**By: Saurav**

**2018-04-08 23:36:00 UTC**

This problem is similar to finding the sum of all elements of the array except the element itself and replacing it with the element.

The concept was sum all elements on the left, sum all elements on right and then add the two.

For this problem, we will use similar two arrays left and right where left stores product of elements on the left of that index and right will have the products of all elements on the right of that index. Finally, we will replace each element of the original array with the product of whats on the right and what's on the left.

let's see it in code:

product_of_remaining([3,7,9,2,6,4]) == [3024, 1296, 1008, 4536, 1512, 2268]

All our tests pass. All our functions do one and only one thing.

And so we are done for now :)

Let me know what you think!

twitter: sprakash24oct

Owned & Maintained by Saurav Prakash

If you like what you see, you can help me cover server costs or buy me a cup of coffee though donation :)