Skip to content

Commit

Permalink
2020-03-11
Browse files Browse the repository at this point in the history
  • Loading branch information
JiayangWu committed Mar 11, 2020
1 parent 6fe5d43 commit 479d34e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class Solution(object):
def gcdOfStrings(self, str1, str2):
"""
:type str1: str
:type str2: str
:rtype: str
"""
if len(str1) < len(str2):
str1, str2 = str2, str1

for i in range(len(str2), 0, -1):

if len(str1) % i == 0 and str2[:i] * (len(str1) / i) == str1 and len(str2) % i == 0 and str2[:i] * (len(str2) / i) == str2:
return str2[:i]
return ""
8 changes: 8 additions & 0 deletions 面试题 16.07.最大数值/面试题 16.07-最大数值.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class Solution(object):
def maximum(self, a, b):
"""
:type a: int
:type b: int
:rtype: int
"""
return max(a, b)

0 comments on commit 479d34e

Please sign in to comment.