FastPrepFirst Unique ID in a Stream
Problems/First Unique ID in a Stream

First Unique ID in a Stream

DoorDash logoDoorDash● MediumFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report does not say what to return when there is no unique id, or how the function is called. We chose those. Our version is about 96% the same as the reported question.

Process a finite stream of operations while maintaining the earliest ID whose total occurrence count is exactly one.

  • [1, id] adds id to the stream.
  • [2] queries the earliest currently unique ID.
  • Return one string per query: the decimal ID, or the literal string null when no ID is unique.
  • An ID leaves the unique order on its second occurrence and never rejoins after later occurrences.

Function

firstUniqueResults(operations: int[][]) → String[]

Examples

Example 1

operations = [[1,2],[1,3],[2],[1,2],[2],[1,3],[2]]return = ["2","3","null"]

ID 2 is initially first. Its second occurrence removes it, leaving 3. After 3 repeats, no unique ID remains.

Example 2

operations = [[2],[1,-5],[2],[1,-5],[2]]return = ["null","-5","null"]

The first query is empty, then -5 is unique until its second occurrence.

Constraints

  • operations is non-empty.
  • Every operation is exactly [1, id] or [2].
  • IDs are signed integers.

More DoorDash Onsite Interview questions

  • Random Dasher Set OperationsONSITE INTERVIEW · Seen Nov 2026
  • Customer Bootstrap APIPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Simulate an Idempotent Refund Service FlowONSITE INTERVIEW · Seen Sep 2026
  • Minimum Parenthesis Removals and Their IndicesONSITE INTERVIEW · Seen Aug 2026
  • Minimum Processing Speed with Multiple RidersONSITE INTERVIEW · Seen Aug 2026
  • Minimum Single-Rider Processing SpeedONSITE INTERVIEW · Seen Aug 2026
  • Restaurant Delivery HeatmapONSITE INTERVIEW · Seen Mar 2026
  • Task Order With PrerequisitesPHONE SCREEN · ONSITE INTERVIEW · Seen Apr 2025
  • All Distinct Palindromic SubstringsONSITE INTERVIEW · Seen Mar 2025
  • Bellman-Ford Route Costs With CreditsONSITE INTERVIEW · Seen Sep 2024

Similar questions at other companies

  • Random Picks Excluding Recent ValuesGoogle · ONSITE INTERVIEWGoogle interview questions
  • Rate Limiter Sliding Window With Per-Entity LimitsRoblox · PHONE SCREEN · ONSITE INTERVIEWRoblox interview questions
  • Metric Counter with a Fake ClockSnap Inc. · ONSITE INTERVIEWSnap Inc. interview questions
  • Per-Client Sliding-Window Rate LimiterNike, Inc. · ONSITE INTERVIEWNike, Inc. interview questions
  • Blocking Keyed Cache with Waiting ReadersDatabricks · ONSITE INTERVIEWDatabricks interview questions
  • Article Vote TrackerRippling · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions
  • Durable Work Queue OperationsOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
  • Keyed Bounded Executor ScheduleMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Matching Engine with Order CancellationIMC Trading · ONSITE INTERVIEWIMC Trading interview questions
  • Callback Signal RegistryCandid Health · PHONE SCREEN

DoorDash interview experiences

  • DoorDash SWE Onsite: Donation System Design: 1 Experience
  • DoorDash SWE Phone Screen: Bootstrap API in Java: 1 Experience
  • DoorDash SWE Virtual Onsite: 1 Experience
  • DoorDash SWE Phone Screen: Bootstrap API Parsing: 1 Experience
  • DoorDash Senior SWE Onsite Interview Experience: 1 Experience
  • DoorDash AI CodeCraft Interview: 8 Experiences
All DoorDash interview questionsSee DoorDash hiring insights
Saved
class Solution {
    public String[] firstUniqueResults(int[][] operations) {
        // TODO: return the earliest currently unique ID for each query.
    }
}
Checking account…