Logger Rate Limiter

easy
1. Design a logger system that receive stream of messages along with its timestamps, each message should be printed if and only if it is not printed in the last 10 seconds. 2. Given a message and a timestamp (in seconds granularity), return true if the message should be printed in the given timestamp, otherwise returns false. 3. It is possible that several messages arrive roughly at the same time.

Input Format

First line contains N(total number of messages to be fed) Second line contains N sapce separated integrs denoting time stamp of ith mesaage. Third line contains N space separated String messages.

Output Format

Return a boolean value each time the function is called.

Constraints

1<=N<=1000
 1<=size of each message <=100

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
5
1 2 3 8 10
foo bar foo bar foo
Output
true true false false false
Previous
Last Stone Weight
Next
Longest Consecutive Subsequence

Related Questions