Write-ahead log compaction
Your task
A write-ahead log records mutations to a key-value store. You are given an ordered list of log entries, each either ["put", key, value] or ["del", key]. Compaction replays the log to compute the final materialized state, where each key's value is whatever the last put for it set (a later del removes the key entirely; a put after a del re-adds it). Return the compacted state as a list of [key, value] pairs sorted by key ascending. Keys are strings; values are integers.
Examples
wal_compact(entries: list[list]) -> list[list]Example 1
Input
wal_compact([["put", "a", 1], ["put", "b", 2], ["put", "a", 3], ["del", "b"]])Output
[["a", 3]]