Relational inner join
Implement a relational inner join of two tables (`left` and `right`), each a list of dict rows, on a shared `key` column. For every pair of left and right rows with equal `key`, emit one merged row containing all of the left row's fields plus all of the right row's fields except a duplicate `key`. Preserve left-major order: iterate left rows in order and, within each, the matching right rows in their original order. Return the list of merged dict rows.
Implement
inner_join(left: list[dict], right: list[dict], key: str) → list[dict]Examples
in
[[{"id":1,"name":"a"}],[{"id":1,"age":30}],"id"]out[{"id":1,"age":30,"name":"a"}]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 25 min
solution.py
InputExpectedGot
[[{"id":1,"name":"a"}],[{"id":1,"age":30}],"id"][{"id":1,"age":30,"name":"a"}]not run yetsample