Implement the RecentCounter class, which counts how many requests arrived within a recent time window.
RecentCounter() starts with no requests.ping(t) records a new request at time t (in milliseconds; t is strictly larger on every call) and returns how many requests, this one included, arrived in the inclusive window [t - 3000, t].Each example lists the calls in order, then each call's arguments, then each call's result (null for the constructor).
1 ≤ t ≤ 10⁹t is strictly larger than the previous one.10⁴ calls are made to ping.Keep a queue of timestamps. On each ping, pop from the front while front < t - 3000.
[null,1,2,3,3]