Dsa
Sorting
Easy
Version Number Cleanup
Sort a list of software version strings. Versions are strings of integers separated by dots (e.g., '1.10.2'). You must compare them numerically at each level (1.2 is smaller than 1.10). All versions provided have exactly three levels: Major.Minor.Patch.
Input Format:
Line 1: Integer N.
Next N lines: A version string.
Output Format:
The sorted version strings, one per line.
Example:
Input:
3
1.10.0
1.2.1
1.2.0
Output:
1.2.0
1.2.1
1.10.0
Key concepts
versioningnumeric strings
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