本文共 498 字,大约阅读时间需要 1 分钟。
class Solution(object): def compareVersion(self, version1, version2): """ :type version1: str :type version2: str :rtype: int """ v1=version1.split('.') v2=version2.split('.') j=len(v1)-1 while j>=0 and int(v1[j])==0: j-=1 v1=v1[:j+1] j=len(v2)-1 while j>=0 and int(v2[j])==0: j-=1 v2=v2[:j+1] i=0 while iint(v2[i]): return 1 elif int(v1[i])
转载地址:http://kwahj.baihongyu.com/