You have a RecentCounter class which counts the number of recent requests within a certain time frame. Implement the RecentCounter class: 1. RecentCounter() Initializes the counter with zero recent requests. 2. int ping(int t) Adds a new request at time t, where t represents some time in milliseconds, and returns the number of requests that has happened in the past 3000 milliseconds (including the new request). Specifically, return the number of requests that have happened in the inclusive range [t - 3000, t]. It is guaranteed that every call to ping uses a strictly larger value of t than the previous call.
Input Format
Input is managed for you
Output Format
Output is managed for you
Constraints
1. 1 <= t <= 10^9 2. Each test case will call ping with strictly increasing values of t.
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
1 100 3001 3002
Output
1 2 3 3