Prompt: 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].
Example:
Input: nums = [1,2,3,4]
Output: [24,12,8,6]
Input: nums = [-1,1,0,-3,3]
Output: [0,0,9,0,0]
Solution: We can solve this with a simple loop. We can first calculate the total product. Then, we can loop through nums and the resulting array at i with be the product divided by nums[i]. This would only be true if there are no zeros. If there is one zero in nums, then we have to leave out the zero in the calculation of the total product and the result value for the ith position where nums[i] = 0 would be the total product. If there are more than 1 zeros, then the whole resulting list would be zeros.The runtime for this solution is O(n).