题目:
代码(首刷看解析 2024年3月31日):
没读懂题~
class RecentCounter {
private:
queue<int> q;
public:
RecentCounter() {
}
int ping(int t) {
q.push(t);
while (q.front() < t - 3000) {
q.pop();
}
return q.size();
}
};
/**
* Your RecentCounter object will be instantiated and called as such:
* RecentCounter* obj = new RecentCounter();
* int param_1 = obj->ping(t);
*/