Count Valid Tokens

Problem Overview

  • Process create/reset commands with timestamps to count tokens still valid at the maximum time point.
  • Input: expiryLimit (int) and commands [type, token_id, T]; Output: number of valid tokens at the largest T.
  • Auth/session domain: tokens expire after expiryLimit; resets extend expiry; expired or missing tokens ignore resets.
  • Rules: no initial tokens; type 0 creates, type 1 resets to T+expiryLimit. A coding interview problem and interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: