← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
Design a versioned document store that supports saving and retrieving text documents at specific timestamps. You need to implement a class VersionedDocumentStore with the following methods:
save(name: str, text: str, timestamp: int) -> None: Save the given text for the document identified by name at the specified timestamp. Timestamps are strictly increasing for each document.get(name: str) -> str: Return the latest saved text for the document. If the document does not exist, return an empty string.getAtTimestamp(name: str, timestamp: int) -> str: Return the text of the document at or before the given timestamp. If the document does not exist or no save occurred at or before the timestamp, return an empty string.The store should efficiently handle multiple documents, each with a potentially long history of versions.