Version tag sorting
A release dashboard lists the tags a repository has published and wants them in ascending version order. Every tag is the letter v followed by one, two or three numeric segments separated by dots, for example v3, v1.4 or v2.10.7. A missing segment counts as zero, so v7 and v7.0.0 name the same version. Compare segment by segment as numbers rather than as text: v2.9.0 comes before v2.10.0 because 9 is less than 10, even though the raw strings say otherwise. Leading zeros carry no meaning, so v01.2.0 equals v1.2.0. Return the tags sorted ascending. When two tags name the same version, keep them in the order they arrived. An empty list returns an empty list.
order_release_tags(tags: list[str]) → list[str][["v2.9.0","v2.10.0","v10.0.0","v2.9.1"]]out["v2.9.0","v2.9.1","v2.10.0","v10.0.0"][["v1.2","v1.2.0","v1.1.9"]]out["v1.1.9","v1.2","v1.2.0"][["v3"]]out["v3"]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.
[["v2.9.0","v2.10.0","v10.0.0","v2.9.1"]]["v2.9.0","v2.9.1","v2.10.0","v10.0.0"]not run yetsample[["v1.2","v1.2.0","v1.1.9"]]["v1.1.9","v1.2","v1.2.0"]not run yetsample[["v3"]]["v3"]not run yetsample