NumPy allowed · plain Python earns 10 bonus points
Implement Product of Array Except Self via two passes (prefix products, then suffix products) -- the classic answer to "compute this without division," which also correctly handles zeros in the input.
Implement product_except_self(nums): first pass left-to-right builds each position's product of everything BEFORE it; second pass right-to-left multiplies in the product of everything AFTER it.
product_except_self(nums: list[int]) -> list[int]