https://leetcode.com/problems/compare-version-numbers/


Runtime: 54 ms, faster than 18.76% of Python3 online submissions for Compare Version Numbers.

Memory Usage: 13.9 MB, less than 87.81% of Python3 online submissions for Compare Version Numbers.


```python
class Solution:
    def compareVersion(self, version1: str, version2: str) -> int:
        #7:59
        def removeZeroInLeftIfThereHasOtherIntegers(string):
            removed = string.replace("0", "")
            if (len(removed) > 0):
                return string.lstrip("0")
            return string
        
        version1Parts = [removeZeroInLeftIfThereHasOtherIntegers(s) for s in version1.split(".")]
        version2Parts = [removeZeroInLeftIfThereHasOtherIntegers(s) for s in version2.split(".")]
        
        maxLength = max(len(version1Parts), len(version2Parts))
        version1Parts += ['0'] * (maxLength - len(version1Parts))
        version2Parts += ['0'] * (maxLength - len(version2Parts))
        
        #print(version1Parts)
        #print(version2Parts)
        
        result = 0
        for i in range(maxLength):
            a = int(version1Parts[i])
            b = int(version2Parts[i])
            if (result == 0):
                if (a < b):
                    result = -1
                if (a > b):
                    result = 1
        return result
        #8:14
        #debug until 8:25
```
