Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Using a map, track the expiry times of the tokens.
When generating a new token, add it to the map with its expiry time.
When renewing a token, check if it's on the map and has not expired yet. If so, update its expiry time.
To count unexpired tokens, iterate on the map and check for each token if it's not expired yet.