We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8a5b995 commit 05fc654Copy full SHA for 05fc654
LeetCode/933.number-of-recent-calls.cpp
@@ -0,0 +1,21 @@
1
+#include<deque>
2
+
3
+class RecentCounter {
4
+ deque<int> req;
5
+public:
6
+ RecentCounter() {
7
+ req = {};
8
+ }
9
10
+ int ping(int t) {
11
+ req.push_back(t);
12
+ while(req.front() < t-3000) req.pop_front();
13
+ return req.size();
14
15
+};
16
17
+/**
18
+ * Your RecentCounter object will be instantiated and called as such:
19
+ * RecentCounter* obj = new RecentCounter();
20
+ * int param_1 = obj->ping(t);
21
+ */
0 commit comments