Code Room
CodingMediumcod-g1075
Subject Database hash indexLevel Mid–Senior~20 minCommon in Databases & SQL · Algorithms & data structures interviewsIndustries Software development

Question

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.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.