Marks :10
: 2 | : 0
Given list of strings which are logs and an integer representing maximum time, determine which user has activity time of less than or equal to the maximum time. Sort and return those list of users. (sort by user id).
Note:
- a user can have multiple sign in an sign-outs, however a sign out will occur only after a sign-in.
- The logs of users can be mixed, however for a given user the sign-out will occur after a corresponding sign-in in the lists
Input Example
logs : ["12 10 sign-in", "5 10 sign-in", "5 100 sign-out", "12 20 sign-out", "8 20 sign-in", "8 50 sign-out"]
maximumTime : 30
Constraints :
2 <= Size of log array (n) <= 2*10^5 (will be an even number)
1<= user_id <= n
1 <= time <= 10^9
1 <= maxTime <= 10^9
First line contains an integer n and k denoting number of entries in the logs array and the maximumTime. The next n lines denote three space serrated values user_id (int) time (int) and a string (sign-in/sign-out) For any given user the sign-in time <= sign-out time
output space separated integers denoting the user id's (in sorted order) who have a total activity time less than or equal to the maximumTIme. if there are no such users, print -1.
6 30 12 10 sign-in 5 10 sign-in 12 20 sign-out 5 100 sign-out 8 20 sign-in 8 20 sign-out
8 12
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.