Company: Microsoft_25july
Difficulty: medium
Token Authentication System Problem Implement a session-based authentication system that manages user sessions with unique tokens and a fixed time-to-live, time_to_live (in seconds). A token created or renewed at time t expires at time t + time_to_live . The system processes a list of queries, each of one of these three types: generate <token_id> <current_time> - at the current time, create a new token with the given ID. It expires at current_time + time_to_live . renew <token_id> <current_time> - at the current time, extend an existing, unexpired token so that it now expires at current_time + time_to_live . The request is ignored if the token has expired or does not exist. count <current_time> - return the number of unexpired tokens at the current time. Important: token expiration is evaluated before processing any action at the same timestamp. If a token's expiration time exactly equals the current time, the token is considered expired: it can no longer