Think about what "all elements except " means. It's all elements to the left of times all elements to the right of . Build two arrays:
= product of all elements before index
= product of all elements after index Then . You're using the same "precompute to answer in " idea, but with products instead of sums, and in both directions.