Version Sort
Versions is a version number list for a project. Because many people maintain it, the format is irregular.
Given an array of version strings, sort them from smallest to largest.
Note: 1.45 is greater than 1.5.
Example:
Input: ["1.45.0", "1.5", "6", "3.3.3.3.3"]
Output: ["1.5", "1.45.0", "3.3.3.3.3", "6"]
This problem is about comparing and sorting version strings. The key is to split each version by dots and compare numeric segments one by one, instead of using plain lexicographical string order. As soon as two segments differ, their numeric values determine the result; for example, 1.45 is greater than 1.5. The sample suggests a custom version ordering rule, so the comparator should be built carefully around numeric parts and segment length.