Code RoomHash index point lookup
MediumPrep Room Coding #240

Hash index point lookup

CodingDatabases & SQLAlgorithms & data structuresMid–Senior~20 min

Build a hash index over a table and answer point lookups. You are given rows as [key, value] pairs (keys are strings, not unique — later rows with the same key shadow earlier ones, last-write-wins) and a list of lookup keys. Build the index once, then for each lookup key return its current value, or the string "__MISS__" if the key is absent. Return a list of values, one per lookup, in order.

Implement
hash_index_lookup(rows: list[list], lookups: list[str]) → list[str]
Examples
in[[["a","1"],["b","2"],["a","9"]],["a","b","c"]]out["9","2","__MISS__"]
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 20 min
InputExpectedGot
[[["a","1"],["b","2"],["a","9"]],["a","b","c"]]["9","2","__MISS__"]not run yetsample