Given an integer array nums, return an array answer such that answer[i] is the product of all elements of nums except nums[i].
nums
answer
answer[i]
nums[i]
Solve it without using division and in O(n).
O(n)
Example
nums = [1, 2, 3, 4] => [24, 12, 8, 6]
function ProductExceptSelf(nums: int[]) -> int[]
Found a bug? Or annoyed about something in the language? Tell us.