Skip to content
This repository was archived by the owner on Sep 22, 2021. It is now read-only.

Commit 2fe7ff0

Browse files
authored
Merge pull request #597 from mkiglics/feature/165
solution for problem 165
2 parents 02f0965 + 3903892 commit 2fe7ff0

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Solution:
2+
def compareVersion(self, version1: str, version2: str) -> int:
3+
v1 = version1.split(".")
4+
v2 = version2.split(".")
5+
while len(v1) < len(v2):
6+
v1.append("0")
7+
while len(v2) < len(v1):
8+
v2.append("0")
9+
for i in range(len(v1)):
10+
a = int(v1[i])
11+
b = int(v2[i])
12+
if a != b:
13+
return (a-b)//abs(a-b)
14+
return 0

0 commit comments

Comments
 (0)