Skip to content

Commit acabec3

Browse files
Create 933.py
1 parent 8206882 commit acabec3

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

501-1000/933.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class RecentCounter:
2+
3+
def __init__(self):
4+
self.requests = deque()
5+
6+
def ping(self, t: int) -> int:
7+
start = t - 3000
8+
self.requests.append(t)
9+
while self.requests and self.requests[0]<start:
10+
self.requests.popleft()
11+
return len(self.requests)
12+
13+
14+
# Your RecentCounter object will be instantiated and called as such:
15+
# obj = RecentCounter()
16+
# param_1 = obj.ping(t)

0 commit comments

Comments
 (0)