Skip to content

Commit dd4d22e

Browse files
committed
add js soultion for leetcode 933
1 parent fb56f1f commit dd4d22e

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
|951|[Flip Equivalent Binary Trees](https://leetcode.com/problems/flip-equivalent-binary-trees/) | |Medium|
3838
|950|[Reveal Cards In Increasing Order](https://leetcode.com/problems/reveal-cards-in-increasing-order/) | |Medium|
3939
|941|[Valid Mountain Array](https://leetcode.com/problems/valid-mountain-array/) | |Easy|
40-
|933|[Number of Recent Calls](https://leetcode.com/problems/number-of-recent-calls/) | |Easy|
40+
|933|[Number of Recent Calls](https://leetcode.com/problems/number-of-recent-calls/) [js](./algorithms/numberOfRecentCalls/numberOfRecentCallsjs) | |Easy|
4141
|931|[Minimum Falling Path Sum](https://leetcode.com/problems/minimum-falling-path-sum/) | |Medium|
4242
|929|[Unique Email Addresses](https://leetcode.com/problems/unique-email-addresses/) | |Easy|
4343
|922|[Sort Array By Parity II](https://leetcode.com/problems/sort-array-by-parity-ii/) | |Easy|
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
var RecentCounter = function() {
2+
this.q = [];
3+
};
4+
5+
/**
6+
* @param {number} t
7+
* @return {number}
8+
*/
9+
RecentCounter.prototype.ping = function(t) {
10+
this.q.push(t);
11+
while (this.q[0] < t - 3000) {
12+
this.q.shift();
13+
}
14+
return this.q.length;
15+
};
16+
17+
/**
18+
* Your RecentCounter object will be instantiated and called as such:
19+
* var obj = new RecentCounter()
20+
* var param_1 = obj.ping(t)
21+
*/

0 commit comments

Comments
 (0)