You are given two version strings — version1 and version2.
Each version string consists of revision numbers separated by dots (.).
Each revision is an integer (ignoring any leading zeros).
Your task is to compare the two version numbers and determine which is greater, smaller, or equal.
Rules:
• Compare revisions from left to right.
• If a version has fewer revisions, treat missing ones as 0.
• Return:
o -1 → if version1 < version2
o 1 → if version1 > version2
o 0 → if both are equal
Input: version1 = "2.4" version2 = "2.10"
Output: -1
Input: version1 = "3.01" version2 = "3.001"
Output: 0
Input: version1 = "5.0" version2 = "5.0.0.0"
Output: 0
Accepted:
Submission: