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)
标签:__,622,int,self,641,RecentCounter,933 From: https://www.cnblogs.com/wuyijia/p/17657399.html