DIY: Product of Array Elements Except Itself

Solve the interview question "Product of Array Elements Except Itself" yourself in this lesson.

We'll cover the following

Problem Statement

Implement a function that takes an array as input and returns an array in which each index in the output array contains the product of all the numbers in the input array except the number stored at that index.

Input:

The input will be an array of integer numbers. The following is an example input:

arr = [1,2,3,4]

Output:

The output array will include a product for each number in the array except the number stored at that index.

arr = [24,12,8,6]

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.