1. Write a class RecentFetch to count recent fetches. 2. It has only one method: ping(int t), where t represents present time in milliseconds. 3. Return the number of pings that have been made from 3000 milliseconds ago until now. 4. Any ping with time in [t - 3000, t] will count, including the current ping. Example inputs = 1 100 3001 3002 Output: 1 2 3 3
Input Format
First line contains 'N' (total number of pings() to be done) Second line contains N integer values denoting the time of corresponding ping(). Note: Every subsequent value should be greater in the second line.
Output Format
N number of integer values
Constraints
Each test case will have at most 10000 calls to ping. Each test case will call ping with strictly increasing values of t. Each call to ping will have 1 <= t <= 10^9.
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
4 1 100 3001 3002
Output
1 2 3 3