cswork / libraryOpen practice workspace

Coding questions · Persona

Implement a Versioned Key-Value File Store

Practice a Persona coding interview problem focused on implement a versioned key-value file store. The prompt emphasizes edge cases, clean implementation, and verifiable test behavior without revealing the solution.

Implement an in-memory file store that supports progressive requirements.

Operations include set(key, value), get(key), delete(key), scan(), scan_prefix(prefix), timestamped gets, and set_ttl(key, value, timestamp, ttl). Expired keys must not be returned.

Implement:

def process_file_store_operations(operations: list[list]) -> list:
    pass

Return booleans for deletes, strings for gets, and lists of key=value strings for scans.

Versioned Key-Value File Store

Process file-store operations including set, get, delete, scan, prefix scan, timestamps, and TTL expiration.

Examples

Example 1

Input: {"operations": [["set","a","1"],["get","a"]]}
Output: ["1"]

Explanation: Basic set/get.

Example 2

Input: {"operations": [["get","missing"]]}
Output: [""]

Explanation: Missing key.