Code RoomVersion tag sorting
EasyPrep Room Coding #4721

Version tag sorting

CodingAlgorithms & data structuresEntry–Mid~16 min

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.

Implement
order_release_tags(tags: list[str]) → list[str]
Examples
in[["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"]
in[["v1.2","v1.2.0","v1.1.9"]]out["v1.1.9","v1.2","v1.2.0"]
in[["v3"]]out["v3"]
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 16 min
InputExpectedGot
[["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