Authentication System ๐น
Develop a session-based authentication system where each user session generates a new token with a specified time-to-live (TTL) expiration. The TTL expiration is calculated as the current time plus the time-to-live seconds. If a token is renewed, the TTL is extended to the time-to-live seconds after the time of the renewal.
There are three types of queries in this system:
Note: If a token expires at a specific time and any action is performed at that same time, the token's expiration occurs before any other actions are carried out.
Complete the function getUnexpiredTokens in the editor below.
getUnexpiredTokens has the following parameter(s):
- 1.
int time_to_live: the time to live for a token - 2.
String[] queries: the queries
Returns
int[]: the results from type-3 query in the same order it is given
1Example 1
[1, 0]. At t = 6, the only unexpired token is "aaa". At t = 15, all tokens have expired, so the count of unexpired tokens is 0.Constraints
Limits and guarantees your solution can rely on.
Unknwon for now