Write-ahead log replay

Write codeMedium25 minSnowflake and Oracle style

Your task

Recover a key-value store by replaying a write-ahead log, then answer point lookups. The log is a list of records applied in order: ['set', key, value] writes/overwrites a key, ['del', key] removes a key (no-op if absent). After replaying the whole log, answer the given lookup keys, returning each key's value or the string 'ABSENT' if it is not present in the recovered state. Keys and values are strings. Return a list of values, one per lookup, in order.

Examples

wal_replay(log: list[list], lookups: list[str]) -> list[str]
Example 1
Inputwal_replay([["set", "a", "1"], ["set", "b", "2"], ["set", "a", "9"], ["del", "b"]], ["a", "b", "c"])
Output["9", "__ABSENT__", "__ABSENT__"]