Product except self, division allowed
Given an integer array nums, return out where out[i] is the product of all elements except nums[i]. This time you may use division.
nums = [1, 2, 3, 4] -> [24, 12, 8, 6]
nums = [2, 0, 3] -> [0, 6, 0]
nums = [2, 0, 3, 0] -> [0, 0, 0, 0]
Solve it in using division, and get the zero cases right.
Show a hint
"Divide the total product by nums[i]" works only when nothing is zero. Count the zeros first; the whole behavior hinges on how many there are.
Your answer
This one is open-ended. Work it through, then check your reasoning against the full solution.