Product of the Others — Solution & Editorial
Prefix products from the left and suffix products from the right; position i multiplies pre[i−1] by suf[i+1]. Zeros are why division fails.
Complexity: O(N)
Watch out: Dividing the total product by ai crashes on zeros and breaks under the modulus — use two-sided products.