FastPrepVersioned Snapshot Set
Problems/Versioned Snapshot Set

Versioned Snapshot Set

OpenAI logoOpenAI● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an OpenAI phone screen for a full-time role. The report leaves out snapshot identifiers, a fixed ordering, and what happens with a duplicate or missing change. We filled those in.

Our version is about 90% the same as the reported question.

Implement a mutable set that can capture immutable snapshots and later return the entire set state stored at a selected snapshot.

Process these operations in input order:

  • ["ADD", value] inserts an integer. Adding an existing value is a no-op.
  • ["REMOVE", value] removes an integer. Removing a missing value is a no-op.
  • ["SNAPSHOT"] captures the current set, assigns the next consecutive zero-based snapshot identifier, and emits [identifier].
  • ["GET_SNAPSHOT", identifier] emits every value captured by that snapshot as decimal strings in ascending numeric order.

ADD and REMOVE emit no result row. Later mutations never change an existing snapshot. Return the emitted rows in operation order.

Function

runSnapshotSet(operations: String[][]) → String[][]

Examples

Example 1

operations = [["ADD","1"],["ADD","3"],["SNAPSHOT"],["REMOVE","3"],["ADD","2"],["GET_SNAPSHOT","0"],["SNAPSHOT"],["GET_SNAPSHOT","1"]]return = [["0"],["1","3"],["1"],["1","2"]]

Snapshot 0 preserves {1, 3} despite later mutations. Snapshot 1 captures {1, 2}.

Constraints

  • 1 <= operations.length <= 200000
  • Values are integers in [-10^9, 10^9].
  • At most 20000 snapshots are created.
  • The sum of current-set sizes across SNAPSHOT operations is at most 200000.
  • The total number of values returned across GET_SNAPSHOT operations is at most 200000.
  • Every GET_SNAPSHOT identifier refers to an existing snapshot.

More OpenAI Phone Screen questions

  • Secret Number Search with One-Call-Delayed FeedbackPHONE SCREEN · Seen Nov 2026
  • Determine the Winner of Three-Card HandsPHONE SCREEN · Seen Nov 2026
  • Grid Infection with Recovery After D DaysPHONE SCREEN · Seen Nov 2026
  • Sparse Plant Infection SimulationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Light Source Hits: Sample, Compare, and FitPHONE SCREEN · Seen Nov 2026
  • Rectangle Point Coverage CountsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Adaptive Calibration ErrorPHONE SCREEN · Seen Nov 2026
  • Elevator Scheduling SimulationPHONE SCREEN · Seen Nov 2026
  • Evaluate Noisy AnnotatorsPHONE SCREEN · Seen Oct 2026
  • Network Endpoint or Cycle BoundaryOA · PHONE SCREEN · Seen Oct 2026

Similar questions at other companies

  • In-Memory Filesystem CommandsPerplexity AI · PHONE SCREEN · ONSITE INTERVIEWPerplexity AI interview questions
  • Camel CardsRippling · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions
  • Banking System with Pending Transfer AcceptanceCircle · PHONE SCREENCircle interview questions
  • Streaming Top-K Frequent ElementsNVIDIA · PHONE SCREENNVIDIA interview questions
  • Interview Slot BookingTrueFoundry · PHONE SCREEN
  • Config Store with Priority OverridesMicrosoft · PHONE SCREENMicrosoft interview questions
  • Document Enrichment Stream AggregatorBloomberg LP · PHONE SCREENBloomberg LP interview questions
  • In-Memory Database with TTL and Historical QueriesZip · PHONE SCREENZip interview questions
  • Banking System with Top ActivityCapital One · ONSITE INTERVIEWCapital One interview questions
  • Temporal Key-Field Database with Prefix ScansThe Trade Desk · OA

OpenAI interview experiences

  • OpenAI OA: What It Tests (2026)
All OpenAI interview questionsSee OpenAI hiring insights
Saved
class Solution {
    public String[][] runSnapshotSet(String[][] operations) {
      // write your code here
    }

}
Checking account…