FastPrepVersioned Document Store
Problems/Versioned Document Store

Versioned Document Store

Notion logoNotion● MediumFULLTIMEINTERNPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Several reports describe saving named documents with text and timestamps. You load the latest value, or the version that was valid at a requested time. A binary-search speedup follows. We only chose how operations are written.

Our version is about 99% the same as the reported questions.

Maintain versions of named text documents. Process these operations in order:

  • ["CREATE", timestamp, name, text] creates the first version of name or overwrites it with a new version at that timestamp.
  • ["GET", name] returns the newest text for that document, or NULL when it has never been created.
  • ["GET_AT", name, timestamp] returns the text from the newest version whose creation timestamp is at most the query timestamp, or NULL when no such version exists.

Return the values produced by GET and GET_AT operations in order.

Function

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

Examples

Example 1

operations = [["CREATE","0","doc","ABC"],["CREATE","3","doc","BCD"],["CREATE","6","doc","CDE"],["GET_AT","doc","1"],["GET_AT","doc","4"],["GET_AT","doc","7"],["GET","doc"]]return = ["ABC","BCD","CDE","CDE"]

Each historical lookup selects the latest creation at or before its timestamp. GET returns the newest version.

Constraints

  • 1 <= operations.length <= 200000.
  • Timestamps are decimal integers in [0, 10^18].
  • CREATE timestamps are strictly increasing for each document name.
  • Names are non-empty ASCII strings containing no whitespace.
  • Text is a printable ASCII string containing neither | nor a newline.
  • The total length of returned text is at most 1000000.

More Notion interview questions

  • Nested Todo ListPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • Mutable Table AggregationsPHONE SCREEN · ONSITE INTERVIEW · Seen Apr 2026
  • Block Type with the Most ChildrenPHONE SCREEN · Seen Mar 2026
  • Country with the Most EventsPHONE SCREEN · Seen Mar 2026
  • Event Type with the Most EventsPHONE SCREEN · Seen Mar 2026
  • Most Popular Active Plan for the Top Event TypePHONE SCREEN · Seen Mar 2026
  • Page Permission InheritancePHONE SCREEN · ONSITE INTERVIEW · Seen Mar 2026
  • Percentage of Blocks Never EditedPHONE SCREEN · Seen Mar 2026
  • Text Document HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Mar 2026
  • Top Error Types in a Time WindowONSITE INTERVIEW · Seen Jun 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
  • 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

  • Notion Interviews, Level Not Reported: 20 Experiences

Notion interview experiences

  • Notion Experienced SWE Interviews: 7 Experiences
  • Notion SWE New Grad Interviews: 3 Experiences
  • Notion SWE Intern Interviews and Debugging Round: 6 Experiences
  • Notion New Grad SWE Onsite Invitations: 2 Experiences
All Notion interview questionsSee Notion hiring insights
Saved
class Solution {
    public String[] runVersionedDocumentStore(String[][] operations) {
        // Write your code here.
    }
}
Checking account…