Dsa
Sorting
Medium
Roman Semantic Versioning
You are building a package manager that uses a unique versioning system. Each version string follows the format 'MAJOR.MINOR.PATCH'. However, the MAJOR version is represented by a Roman Numeral (I, V, X, L, C, D, M), while MINOR and PATCH are standard integers. Sort a list of these version strings primarily by the numeric value of the MAJOR version, then by the MINOR version, and finally by the PATCH version.
Example:
Input: 'V.2.1 II.10.0 V.1.5'
Output:
II.10.0
V.1.5
V.2.1
Key concepts
sortingparsingroman-numerals
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now