← ALL NOTES
Array

1352. Product of the Last K Numbers

Design ProductOfNumbers (add to a stream, product of the last k) via prefix products — with a reset-on-zero trick that turns division's forbidden divisor into a clean bounds check.

Loading…