first time to share my idea in leetcode:

split into arrays

delete the tail arrays of 0

compare the first n array, n is min array length

if the first n array is equal, then the one with more array is the bigger version.
class Solution:
@param a, a string
@param b, a string
@return a boolean
def compareVersion(self, version1, version2):
def removeTailZero(l):
for i in xrange(len(l)1,1,1):
if int(l[i])!=0:
break
del l[i]
v1,v2 = version1.split("."),version2.split(".")
removeTailZero(v1)
removeTailZero(v2)
for i in xrange(min(len(v1),len(v2))):
if int(v1[i])>int(v2[i]):
return 1
elif int(v2[i])>int(v1[i]):
return 1
if len(v1)>len(v2): return 1
elif len(v1)<len(v2): return 1
else: return 0
Hope someone could make it shorter and more beautiful:)