🚀 Blazing-Fast Python Solution: Efficient Product of Last k🐝🚀
🧠 Intuition 🧐Intuitive Thought: Imagine you have a dynamic list where you keep adding numbers. At any point, you want to find the product of the last k numbers.
# 🧠 Intuition 🧐
Intuitive Thought: Imagine you have a dynamic list where you keep adding numbers. At any point, you want to find the product of the last k numbers. To optimize this, we'll maintain a list where each element represents the cumulative product up to that point. If we encounter a zero, we reset the list since the product will always be zero beyond that point.

# 💡 Approach 💻
- **Initialize List:** Start with a list containing 1 to handle multiplication.

- **Add Numbers:** Append each new number to the list. If the number is zero, reset the list to [1].

- **Calculate Product:** Use division to compute the product of the last k numbers.

# 🔍 Why It Works 🧩
- **Cumulative Products:** By maintaining cumulative products, we can quickly calculate the product of the last k numbers using division.

- **Handle Zeros:** If a zero is added, we reset the list since any product involving zero is zero.

- **Efficient Calculation:** The division operation ensures we get the product in constant time.

# ⚙️ Complexity Check 📊
- **Time Complexity:** O(1) for both add and getProduct operations.

- **Space Complexity:** O(n) - The list stores up to n cumulative products.

# Code
```python3 []
import math
class ProductOfNumbers:

    def __init__(self):
        self.prodofnums = []

    def add(self, num: int) -> None:
        self.prodofnums.append(num)
    
    def getProduct(self, k: int) -> int:
        if k > len(self.prodofnums):
            return None
        return math.prod(self.prodofnums[-k: ]) 


# Your ProductOfNumbers object will be instantiated and called as such:
# obj = ProductOfNumbers()
# obj.add(num)
# param_2 = obj.getProduct(k)
```
['Python3']