#NEWLINE# def compareVersion( self , version1 , version2 ) : #NEWLINE# #INDENT# '\n        :type version1: str\n        :type version2: str\n        :rtype int\n        ' #NEWLINE# version1 = map ( int , version1 . split ( '.' ) ) #NEWLINE# version2 = map ( int , version2 . split ( '.' ) ) #NEWLINE# n1 = len ( version1 ) #NEWLINE# n2 = len ( version2 ) #NEWLINE# for i in xrange ( min ( n1 , n2 ) ) : #NEWLINE# #INDENT# if ( version1 [ i ] == version2 [ i ] ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return ( ( - 1 ) if ( version1 [ i ] < version2 [ i ] ) else 1 ) #NEWLINE# #UNINDENT# #UNINDENT# if ( ( n1 == n2 ) or ( ( n1 > n2 ) and all ( map ( ( lambda x : ( x == 0 ) ) , version1 [ n2 : ] ) ) ) or ( ( n1 < n2 ) and all ( map ( ( lambda x : ( x == 0 ) ) , version2 [ n1 : ] ) ) ) ) : #NEWLINE# #INDENT# return 0 #NEWLINE# #UNINDENT# return ( ( - 1 ) if ( n1 < n2 ) else 1 )