Back to course home
0% completed
Product of Array Except Self (Medium)
Problem Statement
Given an array of integers, return a new array where each element at index i
of the new array is the product of all the numbers in the original array except the one at i
. You must solve this problem without using division.
Examples
-
- Input:
[2, 3, 4, 5]
- Expected Output:
[60, 40, 30, 24]
- Justification: For the first element:
3*4*5 = 60
, for the second element:2*4*5 = 40
, for the third element:2*3*5 = 30
, and for the fourth element:2*3*4 = 24
.
- Input:
-
- Input:
[1, 1, 1, 1]
- Expected Output:
[1, 1, 1, 1]
- Input:
.....
.....
.....
Like the course? Get enrolled and start learning!