Code Room
CodingEasycod-g1267
Subject HashingLevel Entry–Mid~10 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

A catalog cleanup ships with a rename table: a dictionary whose key is a deprecated tag and whose value is its replacement. Apply the table to a list of tags: each tag that appears as a key is replaced by its mapped value exactly once — the replacement is NOT looked up again, so chains like a to b and b to c must not turn "a" into "c". Tags absent from the table pass through unchanged, and the output keeps the input order and length. For example, tags ["lofi", "rock", "chill"] with renames {"lofi": "lo-fi", "chill": "calm"} give ["lo-fi", "rock", "calm"].

Implement
apply_renames(tags: list[str], renames: dict[str,str]) → list[str]
Examples
in[["lofi","rock","chill"],{"lofi":"lo-fi","chill":"calm"}]out["lo-fi","rock","calm"]
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.