Compute maximum product of all entries but one - variant 1

#1

[Problem 25.4 EPIJ v 1.6.1]

The problem (variant 1) constrains additional space to O(1). But it also says “Compute an array B where B[i] is the product of all elements in A except A[i].”

Does this mean we have 2 arrays to work with? In other words, is B a second array instance, or just the same array as A, but with the elements updated to be the products?

0 Likes

#2

B is the output array which won’t counts as “additional” space.

1 Like