Inner equi-join
Your task
Implement an inner equi-join over two lists of records. left and right are lists of dicts. Join them where left[key_l] == right[key_r]. For each matching pair, produce a merged dict that contains all keys from the left record plus all keys from the right record EXCEPT key_r (to avoid an obvious duplicate of the join column); on any other key collision the right value wins. Preserve output order by left record order, then right record order. Return the list of merged dicts.
Examples
inner_join(left: list[dict], right: list[dict], key_l: str, key_r: str) -> list[dict]Example 1
Input
inner_join([{"id": 1, "name": "a"}], [{"uid": 1, "city": "ny"}], "id", "uid")Output
| id | name | city |
|---|---|---|
| 1 | a | ny |