The extra space solution uses the output array for prefix products, then multiplies in suffix products in a second pass. First pass: product of all elements before .
Start with , then . Second pass: track (product of elements after current index). For each from down to : , then . After both passes, = product of all elements except . Time: , Space: excluding output.