Skip to content

Commit 6ae9072

Browse files
Added 933. Number of Recent Calls (#70)
* Added 933. Number of Recent Calls * Update README.md As stated I have updated the README.md file and listed the problem under queue section. Also I have added myself to the contributors list.
1 parent 7c5ba68 commit 6ae9072

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

C++/Number-of-Recent-Calls.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include<deque>
2+
class RecentCounter {
3+
deque<int> req;
4+
public:
5+
RecentCounter() {
6+
req={};
7+
}
8+
9+
int ping(int t) {
10+
req.push_back(t);
11+
while(req.front() < t-3000) req.pop_front();
12+
return req.size();
13+
}
14+
};
15+
16+
/**
17+
* Your RecentCounter object will be instantiated and called as such:
18+
* RecentCounter* obj = new RecentCounter();
19+
* int param_1 = obj->ping(t);
20+
*/

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,18 @@ Check out ---> [Sample PR](https://github.com/codedecks-in/LeetCode-Solutions/pu
161161
</div>
162162
<br/>
163163

164+
# Queue
165+
166+
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
167+
| ---- | --------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | --------- | --------- | ---------- | ---------------------------------------------- | ---- |
168+
| 933 | [Number of Recent Calls](https://leetcode.com/problems/number-of-recent-calls/) | [C++](./C++/Number-of-Recent-Calls.cpp ) | _O(1)_ | _O(1)_ | Easy | Queue, Sliding Window
169+
170+
<br/>
171+
<div align="right">
172+
<b><a href="#algorithms">⬆️ Back to Top</a></b>
173+
</div>
174+
<br/>
175+
164176
# Tree
165177

166178
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
@@ -375,6 +387,8 @@ DISCLAIMER: This above mentioned resources have affiliate links, which means if
375387
| [Prashansa Tanwar](https://github.com/prashansatanwar) <br> <img src="https://github.com/prashansatanwar.png" width="100" height="100"> | India | C++ | [Leetcode](https://leetcode.com/prashansaaa/) |
376388
| [Ishu Raj](https://github.com/ir2010) <br> <img src="https://github.com/ir2010.png" width="100" height="100"> | India | C++ | [Leetcode](https://leetcode.com/ishuraj2010/) |
377389
| [Rakesh Bhadhavath](https://github.com/Revenge-Rakesh) <br> <img src="https://avatars2.githubusercontent.com/u/36032275?v=4" width="100" height="100"> | India | Java | [Leetcode](https://leetcode.com/goal_cracker/) |
390+
| [Tarun Singh](https://github.com/TarunSingh56) <br> <img src="https://avatars3.githubusercontent.com/u/25122604?s=400&u=d01f190e9a8c3790d408c38387c68b6bc9db2ea6&v=4" width="100" height="100"> | India | C++ | [Leetcode](https://leetcode.com/_tarun/) |
391+
378392

379393
<br/>
380394
<div align="right">

0 commit comments

Comments
 (0)