class Solution:
def compareVersion(self, version1: str, version2: str) -> int:
"""
step1: split '.' out of str and convert each segment into integer to remove leading 0 s and then save them to []
step2: find max length of the two lists. start loop each list
step3: get current segment value, check if i out of current list's boundry, if yes, assign a 0 else assign v[i]
step4: compare vv1, vv2, if vv1 > vv2 return 1; if vv1 < vv2 return -1
step5: if whole loop finished, there is no conclusion for bigger number between v1,v2. means they'r equal, return 0
time O(N) space O(N) if we need to recreate new list to store processed lists.
"""
v1 = [int(v) for v in version1.split('.')]
v2 = [int(v) for v in version2.split('.')]
l1 = len(v1)
l2 = len(v2)
for i in range(max(l1,l2)):
vv1 = v1[i] if i < l1 else 0
vv2 = v2[i] if i < l2 else 0
if vv1 > vv2:
return 1
elif vv1 < vv2:
return -1
return 0