FastPrepSimplified Time-Based Key-Value Store
Problems/Simplified Time-Based Key-Value Store

Simplified Time-Based Key-Value Store

SpaceX logoSpaceX● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a SpaceX phone screen. The report describes a simpler Time-Based Key-Value Store task. It does not give the exact simplification, the corrected examples or the function signature. Our version is about 75% the same as the reported idea.

Implement a simplified time-based key-value store by processing a sequence of operations in order.

Each operation is represented as an array of strings:

  • ["set", key, value, timestamp] stores value for key at timestamp.
  • ["get", key, timestamp] asks for the value stored for key at the greatest set timestamp less than or equal to timestamp.

The timestamp in each operation is a base-10 integer encoded as a string. If a get operation has no qualifying stored value, its result is the empty string. Return the results of the get operations in their original order; set operations do not add an entry to the returned array.

Function

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

Examples

Example 1

operations = [["set","foo","bar","1"],["get","foo","1"],["get","foo","3"],["set","foo","bar2","4"],["get","foo","4"],["get","foo","5"]]return = ["bar","bar","bar2","bar2"]

The first two queries use the value stored at timestamp 1. After the second set, queries at timestamps 4 and 5 use bar2.

Example 2

operations = [["get","missing","7"],["set","x","one","10"],["get","x","9"],["get","x","10"]]return = ["","","one"]

The missing key and the query before x is first stored both return an empty string. The exact-timestamp query returns one.

Example 3

operations = [["set","alpha","a1","2"],["set","beta","b1","3"],["set","alpha","a2","8"],["get","alpha","7"],["get","beta","100"],["get","alpha","8"]]return = ["a1","b1","a2"]

Histories are independent by key, and each query uses the latest qualifying timestamp for that key.

Constraints

  • 1 <= operations.length <= 200000
  • Every operation begins with "set" or "get".
  • A set operation has exactly four fields; a get operation has exactly three fields.
  • 1 <= key.length, value.length <= 100, and keys and values contain only lowercase English letters and digits.
  • Every timestamp is a base-10 integer in the range [1, 10000000].
  • The timestamps of set operations are strictly increasing.

More SpaceX interview questions

  • Starlink Beam PlannerOA · PHONE SCREEN · Seen Nov 2026
  • Timestamped Telemetry Stream DifferencesPHONE SCREEN · Seen Sep 2026
  • Number of IslandsPHONE SCREEN · Seen Aug 2026
  • Number of Islands IIPHONE SCREEN · Seen Aug 2026
  • Button Combination DetectorPHONE SCREEN · Seen Feb 2026
  • Pressure Chamber Linear InterpolationPHONE SCREEN · Seen Jun 2025
  • Speed to Pressure LookupPHONE SCREEN · Seen Mar 2025
  • Rocket Component CostONSITE INTERVIEW · Seen Aug 2025
  • DNA Sequence MatchOA · Seen Apr 2025
  • Find the Duplicate NumberONSITE INTERVIEW · Seen Jan 2021

Similar questions at other companies

  • Consistent-Hash Packet RouterAmazon · PHONE SCREEN
  • Snapshot Map with Sparse Version HistorySnorkel AI · PHONE SCREEN
  • Time-Based Key-Value StoreOracle · PHONE SCREEN · ONSITE INTERVIEWOracle interview questions
  • Time-Based Key-Value StoreCockroach Labs · PHONE SCREEN · ONSITE INTERVIEW
  • Time Map with Sum and AverageConfluent · PHONE SCREENConfluent interview questions
  • Structured Log Stream with QueriesOpenAI · PHONE SCREENOpenAI interview questions
  • Time-Based Key-Value StoreVerkada · PHONE SCREENVerkada interview questions
  • Interview Slot BookingTrueFoundry · PHONE SCREEN
  • Frequency-Weighted Next-Word SamplingGoogle · PHONE SCREENGoogle interview questions
  • Time-Based Key-Value Map With Floor and Ceiling QueriesCharacter.AI · PHONE SCREEN

Interview reports that mention this question

  • 2013–2026 SpaceX Full-Time OA / Interviews: 45 Experiences (Part 2 :)
  • SpaceX Software Engineer OA and Interviews: 27 Experiences
  • SpaceX Software Engineer L2 Technical Interview: 1 Experience

SpaceX interview experiences

  • SpaceX Full-Time Interview Cycle and Delayed Decision
  • SpaceX Experienced Engineer Full-Time Thirteen-Interview Process
  • SpaceX Senior Hardware Engineer Full-Time Interrupted Onsite
All SpaceX interview questionsSee SpaceX hiring insights
Saved
class Solution {
    public String[] timeMapResults(String[][] operations) {
        // write your code here.
    }
}
Checking account…