基础题队列933、225、622、641
933. 最近的请求次数
1 class RecentCounter: 2 3 def __init__(self): 4 self.q = collections.deque() 5 6 def ping(self, t: int) -> int: 7 self.q.append(t) 8 9 while self.q[0] < t - 3000: 10 self.q.popleft() 11 12 return len(self.q) 13 14 15 16 # Your RecentCounter object will be instantiated and called as such: 17 # obj = RecentCounter() 18 # param_1 = obj.ping(t)