Given an integer array nums, return an array answer such that answer[i] is equal to the product of all elements of nums except nums[i]. You must write an algorithm that runs in O(n) time and without using the division operation.
nums = [1,2,3,4][24,12,8,6]nums = [-1,1,0,-3,3][0,0,9,0,0]ans[i] = product of all left × product of all right. The prefix pass fills left products into ans[] directly. The suffix pass multiplies the right products in-place using a running variable. We reuse the output array itself, so no extra space is needed beyond a single scalar.