Product of Array Except Self

Prefix + suffix · Carry information from both directions · Stretch · about 26 min

Why it matters

Two directional passes often replace division or nested loops.

How it connects

You used prefix state before. This adds one calm pass from the right.

Try first

For each index, which product comes from values strictly before it and strictly after it?

Interview cue

The answer at each index is independent prefix product times independent suffix product.