diff --git a/LeetCode/933.number-of-recent-calls.cpp b/LeetCode/933.number-of-recent-calls.cpp new file mode 100644 index 0000000..20c3f03 --- /dev/null +++ b/LeetCode/933.number-of-recent-calls.cpp @@ -0,0 +1,21 @@ +#include + +class RecentCounter { + deque 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); + */