Company: Microsoft_30Aug
Difficulty: medium
Token Management System Problem Description A session-based authentication service hands out tokens. Every token has the same time-to-live, time_to_live seconds: a token that is generated or renewed at time t expires at time t + time_to_live . The service receives q queries, processed one after another in the given order. Each query is one of: generate <token_id> <current_time> : at time current_time , create a new token with the id token_id . It expires at current_time + time_to_live . renew <token_id> <current_time> : at time 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 already expired or was never generated. count <current_time> : report the number of unexpired tokens at time current_time . Important: expiration is evaluated before any action at the same timestamp. A token whose expiration time equals the current time is already expired: it can no longe