Diff config changes

Write codeMedium14 min

Your task

Before rolling out, a deploy pipeline prints how the proposed config differs from what is currently running. Both configs arrive as lines; parse each the usual way: trim, drop blanks and "#" comments, split at the first "=", trim key and value, repeated keys keep the final value. Produce one report entry per differing key: "+ key" when only the proposal has it, "- key" when only the running config has it, and "~ key" when both have it with different values. Order the report alphabetically by key name and return it as a list of strings. Identical keys produce nothing.

Examples

config_drift(current: list[str], proposed: list[str]) -> list[str]
Example 1
Inputconfig_drift(["a=1", "b=2"], ["b=3", "c=4"])
Output["- a", "~ b", "+ c"]