參考資訊:
https://www.cnblogs.com/grandyang/p/12359774.html
題目:

解答:
class RecentCounter {
public:
RecentCounter() {
}
int ping(int t) {
while (!q.empty()) {
if (q.front() >= (t - 3000)) {
break;
}
q.pop();
}
q.push(t);
return q.size();
}
private:
queue<int> q;
};
/**
* Your RecentCounter object will be instantiated and called as such:
* RecentCounter* obj = new RecentCounter();
* int param_1 = obj->ping(t);
*/