Time-Based Key-Value Store
Updated
Problem statement
Process set and get operations on a time-based key-value store. A get returns the value written for that key at the greatest timestamp not exceeding the query timestamp, or the empty string when none exists. Return "null" for set operations.
Function
runTimeMap(operations: String[], keys: String[], values: String[], timestamps: int[]) → String[]Examples
Example 1
operations = ["set","get","get","set","get"]keys = ["foo","foo","foo","foo","foo"]values = ["bar","","","bar2",""]timestamps = [1,1,3,4,4]return = ["null","bar","bar","null","bar2"]Each query sees the most recent value for foo at or before its timestamp.
Constraints
- All four arrays have equal non-zero length.
- Set timestamps for each key are strictly increasing.
- There are at most
100000operations.
More Verkada Phone Screen questions
- Host Log ParserPHONE SCREEN · Seen Sep 2026
- Find the Unique User with Access to Every CameraPHONE SCREEN · Seen Sep 2026
- Valid SudokuPHONE SCREEN · Seen Sep 2026
- Common Camera Motion IntervalsPHONE SCREEN · Seen Sep 2026
- Camera Log API SequencePHONE SCREEN · Seen Aug 2026
- Find Valid IP AddressesPHONE SCREEN · Seen Apr 2026
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
- 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
- Versioned Document StoreNotion · PHONE SCREENNotion interview questions