DIY: Product of Array Elements Except Itself

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

Problem Statement

Implement a function that takes a list as input and returns a list in which each index in the output list contains the product of all the numbers in the input list 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.