dsa · easy
Number of Recent Calls
GreyOrangeQueueDesignFoundation
RecentCounter. ping(t) records a ping at time t (t strictly increasing) and returns how many pings fall in the closed window [t-3000, t].
Fill in the RecentCounter class. The starter already walks ops / args and calls your methods — leave the driver at the bottom as-is. Constructors contribute null; booleans print as true / false.
**Example**
`` RecentCounter() → null ping(1) → 1 ping(100) → 2 ping(3001) → 3 ping(3002) → 3 ``
Constraints
1 <= calls <= 10000, t strictly increasing
Examples
Example 1
Input: ["RecentCounter","ping","ping","ping","ping"] [[],[1],[100],[3001],[3002]] Expected: [null,1,2,3,3]