class Solution:
def gcdOfStrings(self, str1: str, str2: str) -> str:
ans = ""
for i in range(1,len(str1)+1):
if len(str1) % i == 0 and len(str2) % i == 0:
x = len(str1) // i
y = len(str2) // i
z = str1[:i]
if str1 == z * x and str2 == z * y:
ans = z
return ans
오늘 문제 풀기 싫었는데 쉬운거라서 다행
어제 야근하느라 문제 보지도 못 함;; 근데 어렵드라
댓글 0