Desktop only
Coding Challenges are optimized for Desktop
Come back on a wider screen - the live editor needs room to breathe. You can still read the problem brief above.
Come back on a wider screen - the live editor needs room to breathe. You can still read the problem brief above.
class Database:
def set(self, key: str, value: str) -> None: ...
def get(self, key: str) -> str | None: ...
def delete(self, key: str) -> bool: ...def scan(self, prefix: str) -> list[str]:
"""Keys that start with `prefix`, sorted alphabetically."""
def scan_values(self, prefix: str, value_filter: str) -> list[tuple[str, str]]:
"""(key, value) pairs where the key starts with `prefix` AND the value
contains `value_filter` as a substring. Sorted by key."""def set(self, key: str, value: str,
ttl_ms: int | None = None,
now_ms: int | None = None) -> None: ...def dump(self, path: str) -> None:
"""Serialize the database to a gzip-compressed JSON file."""
def load(self, path: str, now_ms: int | None = None) -> None:
"""Load from a dump file. Discard entries that have already expired."""