FastPrepDesign Authentication Manager
Problems/Design Authentication Manager

Design Authentication Manager

Oracle logoOracle● MediumFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Oracle onsite interview. The report keeps the operations on tokens that expire. It does not give a function signature, the exact moment a token expires, examples, or the input limits. We added those. Our version is about 90% the same as the reported question.

A later report describes a round similar to an expiration token or time-based rate limiter, which appears to be this task, and says its follow-ups were about scalability and sorting, with no details. They are in the editorial and are not graded.

The limit on operations is 500 here, down from 2000, so that the largest test runs in every language.

You are given a token lifetime timeToLive and an ordered array of authentication-manager operations operations.

Each operation is an array of three strings: [type, tokenId, currentTime]. The supported operation types are:

  • GENERATE: create the unique token tokenId at currentTime. Its expiration time becomes currentTime + timeToLive.
  • RENEW: if tokenId exists and is unexpired at currentTime, reset its expiration time to currentTime + timeToLive. Otherwise, ignore the operation.
  • COUNT: count the tokens that are unexpired at currentTime. For this operation, tokenId is the empty string.

A token is unexpired at time t exactly when its expiration time is strictly greater than t. Therefore, a token is already expired at the instant equal to its expiration time.

Return one count for every COUNT operation, preserving query order. GENERATE and RENEW operations do not add values to the returned array.

Function

countUnexpiredTokens(timeToLive: int, operations: String[][]) → int[]

Examples

Example 1

timeToLive = 5operations = [["GENERATE","aaa","1"],["RENEW","aaa","2"],["COUNT","","6"],["GENERATE","bbb","7"],["RENEW","aaa","8"],["RENEW","bbb","10"],["COUNT","","12"]]return = [1,1]

Token aaa first expires at time 6, then renewal at time 2 moves its expiration to 7, so the count at time 6 is 1. It is expired by time 8, so that renewal is ignored. Token bbb is renewed from expiration time 12 to 15, so the count at time 12 is also 1.

Example 2

timeToLive = 3operations = [["GENERATE","alpha","1"],["COUNT","","3"],["COUNT","","4"]]return = [1,0]

Token alpha expires at time 4. It is unexpired at time 3 but expired at time 4.

Example 3

timeToLive = 4operations = [["RENEW","ghost","1"],["GENERATE","x","2"],["GENERATE","y","3"],["RENEW","x","4"],["COUNT","","5"],["COUNT","","7"],["COUNT","","8"]]return = [2,1,0]

Renewing the missing token ghost has no effect. Renewal moves token x's expiration to time 8, while token y expires at time 7. The three counts are therefore 2, 1, and 0.

Constraints

  • 1 <= timeToLive <= 10^8.
  • 1 <= operations.length <= 500.
  • Every operation contains exactly three strings and uses one of GENERATE, RENEW, or COUNT.
  • Every non-empty tokenId contains from 1 through 10 lowercase English letters.
  • Every token ID used by GENERATE is unique.
  • Operation times are decimal integers from 1 through 10^8 and are strictly increasing across the array.

More Oracle Onsite Interview questions

  • Course ScheduleONSITE INTERVIEW · Seen Nov 2026
  • Shortest Subarray with Sum at Least KONSITE INTERVIEW · Seen Nov 2026
  • Longest Substring Without Repeating CharactersONSITE INTERVIEW · Seen Nov 2026
  • Minimum Meeting RoomsONSITE INTERVIEW · Seen Nov 2026
  • Shortest Window with Required CountsONSITE INTERVIEW · Seen Nov 2026
  • Maximum Subarray Sum with One DeletionONSITE INTERVIEW · Seen Nov 2026
  • Shortest Deletion for Distinct CharactersONSITE INTERVIEW · Seen Nov 2026
  • Count Dropped Rate-Limited RequestsONSITE INTERVIEW · Seen Nov 2026
  • Maximum Bouquet ValueONSITE INTERVIEW · Seen Oct 2026
  • Cache an Expensive Service Across ThreadsONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Thread-Safe Task Storage and Worker DispatchNuro · ONSITE INTERVIEWNuro interview questions
  • Notification Deduplication WindowGoldman Sachs · ONSITE INTERVIEWGoldman Sachs interview questions
  • Helpdesk Ticket ProcessingThe Walt Disney Company · ONSITE INTERVIEWThe Walt Disney Company interview questions
  • Execute Tasks by PrioritySnowflake · ONSITE INTERVIEWSnowflake interview questions
  • Priority Job Scheduler with CooldownsGoogle · ONSITE INTERVIEWGoogle interview questions
  • 15-Minute Chat Session TrackerOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
  • LRU Cache with TTLAutodesk · ONSITE INTERVIEWAutodesk interview questions
  • Tiered Expiring Item StoreHudson River Trading · PHONE SCREEN · ONSITE INTERVIEWHudson River Trading interview questions
  • Limit Order Book Matching EngineCitadel · PHONE SCREEN · ONSITE INTERVIEWCitadel interview questions
  • Expiring Key SetAmazon · ONSITE INTERVIEW

Oracle interview experiences

  • Oracle SWE Onsite Interview Experience: 1 Experience
All Oracle interview questionsSee Oracle hiring insights
Saved
class Solution {
    public int[] countUnexpiredTokens(int timeToLive, String[][] operations) {
      // write your code here
    }
}
Checking account…