Given two version strings, version1 and version2, compare them. A version string consists of revisions separated by dots '.'. The value of the revision is its integer conversion ignoring leading zeros. To compare version strings, compare their revision values in left-to-right order. If one version string has fewer revisions, treat the missing revision values as 0. Return -1 if version1 < version2, 1 if version1 > version2, and 0 otherwise.
Example 1
Input: version1 = 1.2, version2 = 1.10
Output: -1
Explanation: The first revisions are equal (1 = 1). The second revisions are 2 and 10, and 2 < 10, so version1 is smaller and the answer is -1.
Example 2
Input: version1 = 1.01, version2 = 1.001
Output: 0
Explanation: Leading zeros are ignored, so "01" and "001" are both the number 1. Every revision matches, so the answer is 0.
Example 3
Input: version1 = 1.0, version2 = 1.0.0
Output: 0
Explanation: version1 has no third revision, so it counts as 0. Then 1.0.0 vs 1.0.0 matches everywhere, and the answer is 0.
Split each version into revision numbers and compare them position by position as integers, padding the shorter one with zeros.
Run checks all cases above. Submit evaluates all test cases.