
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Keep all prefix products of numbers in an array, then calculate the product of last K elements in O(1) complexity.
When a zero number is added, clean the array of prefix products.