Skip to content

Commit

Permalink
Create 933.number-of-recent-calls.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
rachitiitr authored Oct 1, 2020
1 parent 8a5b995 commit 05fc654
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LeetCode/933.number-of-recent-calls.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include<deque>

class RecentCounter {
deque<int> req;
public:
RecentCounter() {
req = {};
}

int ping(int t) {
req.push_back(t);
while(req.front() < t-3000) req.pop_front();
return req.size();
}
};

/**
* Your RecentCounter object will be instantiated and called as such:
* RecentCounter* obj = new RecentCounter();
* int param_1 = obj->ping(t);
*/

0 comments on commit 05fc654

Please sign in to comment.