← All problems

Product of Array Except Self

MediumPrefix Products

Given an array `nums`, return an array where output[i] is the product of every element of `nums` EXCEPT nums[i]. Don't use division. O(n) time.

Examples

Input: [1,2,3,4]
Output: [24,12,8,6]

Hints

Solution

Language:
Loading editor…
Output0 lines
Run your code to see output here.
Click Run all tests to check your solution against 3 test cases.