[LeetCode] 1352. Product of the Last K Numbers (Python)
·
알고리즘/LeetCode
난이도: Medium문제 설명Design an algorithm that accepts a stream of integers and retrieves the product of the last k integers of the stream. Implement the ProductOfNumbers class:ProductOfNumbers() Initializes the object with an empty stream.void add(int num) Appends the integer num to the stream.int getProduct(int k) Returns the product of the last k numbers in the current list. You can assume that alw..