Product of Array Except Self
EasyArrayPrefix SumSuffix Product
Given an integer array nums, return an array answer such that:
- answer[i] is equal to the product of all the elements of nums except nums[i].
- You must solve it without using division.
- The solution should run in O(n) time.
The product of any prefix or suffix of the array fits in a 32-bit integer.
Examples
Example 1
Input: [1,2,3,4]
Output: [24,12,8,6]