Given an array of integers, replace each element of the array with the product of every other element in the array. Return the modified array.

Let array `arr`

equal to `[ 1, 2, 3, 4, 5 ]`

. If we multiply the elements accordingly, we'll get the array `[ 120, 60, 40, 30, 24 ]`

. The solution should return this array.

Contributed by Murat Sütunç

You are not signed in. You can only run/submit code after signing in. Create your free Codela account now!