Code RoomApply tag renames
EasyPrep Room Coding #450

Apply tag renames

CodingAlgorithms & data structuresEntry–Mid~10 min

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.

0:00 of about 10 min
InputExpectedGot
[["lofi","rock","chill"],{"lofi":"lo-fi","chill":"calm"}]["lo-fi","rock","calm"]not run yetsample