Command line argument parsing
A deploy tool reads its own argument vector rather than pulling in a parser. Scan argv left to right. A token that is exactly "--" closes option scanning, and every token after it is a plain argument. Until then: a token starting with "--" is a long option, where "--name=value" splits on its first "=" only (the value may be empty) and "--name" alone is worth "true"; a token starting with a single dash and holding at least one more character is a bundle whose every remaining character is a switch worth "true". Anything else, a lone "-" included, is a plain argument and sets nothing. Setting a name twice keeps the newer value at the older position. Return one "name=value" string per distinct name, ordered by where each name first appeared.
resolve_cli_options(argv: list[str]) → list[str][["deploy","--env=staging","-vq","--dry-run","--","--force","app.zip"]]out["env=staging","v=true","q=true","dry-run=true"][["--tag=rc1","--tag=rc2","-t"]]out["tag=rc2","t=true"][["--path=/opt/tools=bin"]]out["path=/opt/tools=bin"]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.
[["deploy","--env=staging","-vq","--dry-run","--","--force","app.zip"]]["env=staging","v=true","q=true","dry-run=true"]not run yetsample[["--tag=rc1","--tag=rc2","-t"]]["tag=rc2","t=true"]not run yetsample[["--path=/opt/tools=bin"]]["path=/opt/tools=bin"]not run yetsample