自信的姐姐

关注

【Leetcode_easy】1071. Greatest Common Divisor of Strings

自信的姐姐

关注

阅读 52

2022-07-12

problem

​​1071. Greatest Common Divisor of Strings​​

solution

class Solution {
public:
string gcdOfStrings(string str1, string str2) {
return (str1+str2==str2+str1) ?
(str1.substr(0, gcd(str1.size(), str2.size()))) : "";
}
};

 

参考

1. ​​Leetcode_easy_1071. Greatest Common Divisor of Strings​​;

完

相关推荐

鲤鱼打个滚

LeetCode 1071. Greatest Common Divisor of Strings (Java版; Easy)

鲤鱼打个滚 87 0 0

生活记录馆

【Leetcode_easy】1170. Compare Strings by Frequency of the Smallest Character

生活记录馆 61 0 0

ZMXQQ233

D9:Greatest Common Divisor(最大公约数,附题解)

ZMXQQ233 33 0 0

科牛

3.8_greatest_common_divisor_欧几里得算法_最大公约数 (gcd)

科牛 67 0 0

书呆鱼

Leetcode 1071. 字符串的最大公因子

书呆鱼 77 0 0

雅典娜的棒槌

【Leetcode_easy】867. Transpose Matrix

雅典娜的棒槌 93 0 0

小铺有酒一两不够

【Leetcode_easy】645. Set Mismatch

小铺有酒一两不够 82 0 0

舟海君

【leetcode_easy】299. Bulls and Cows

舟海君 160 0 0

软件共享软件

【Leetcode_easy】690. Employee Importance

软件共享软件 92 0 0

骨灰级搬砖工

【Leetcode_easy】1051. Height Checker

骨灰级搬砖工 203 0 0

精彩评论(0)

0 0 举报