class RecentCounter {
Queue<Integer> l;
public RecentCounter() {
l = new LinkedList();
}
public int ping(int t) {
l.add(t);
while(l.peek()< t-3000){
l.poll();
}
return l.size();
}
}
/**
* Your RecentCounter object will be instantiated and called as such:
* RecentCounter obj = new RecentCounter();
* int param_1 = obj.ping(t);
*/
最近请求的次数
最新推荐文章于 2024-01-12 11:13:46 发布