Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 479d34e

Browse files
committed
2020-03-11
1 parent 6fe5d43 commit 479d34e

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution(object):
2+
def gcdOfStrings(self, str1, str2):
3+
"""
4+
:type str1: str
5+
:type str2: str
6+
:rtype: str
7+
"""
8+
if len(str1) < len(str2):
9+
str1, str2 = str2, str1
10+
11+
for i in range(len(str2), 0, -1):
12+
13+
if len(str1) % i == 0 and str2[:i] * (len(str1) / i) == str1 and len(str2) % i == 0 and str2[:i] * (len(str2) / i) == str2:
14+
return str2[:i]
15+
return ""
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class Solution(object):
2+
def maximum(self, a, b):
3+
"""
4+
:type a: int
5+
:type b: int
6+
:rtype: int
7+
"""
8+
return max(a, b)

0 commit comments

Comments
 (0)