GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • 注册
  • Plus 会员

This view

  • Original page
  • New address

GeezerVison is showing leetcode.cn — 1071. 字符串的最大公因子 - 力扣(LeetCode)

题目描述
题目描述
题解
题解
提交记录
提交记录
1071. 字符串的最大公因子
简单

对于字符串 s 和 t,只有在 s = t + t + t + ... + t + t(t 自身连接 1 次或多次)时,我们才认定 “t 能除尽 s”。

给定两个字符串 str1 和 str2 。返回 最长字符串 x,要求满足 x 能除尽 str1 且 x 能除尽 str2 。

 

 

示例 1:

输入:str1 = "ABCABC", str2 = "ABC"

输出:"ABC"

示例 2:

输入:str1 = "ABABAB", str2 = "ABAB"

输出:"AB"

示例 3:

输入:str1 = "LEET", str2 = "CODE"

输出:""

示例 4:

输入:str1 = "AAAAAB", str2 = "AAA"

输出:""

 

提示:

  • 1 <= str1.length, str2.length <= 1000
  • str1 和 str2 由大写英文字母组成
 
代码
代码
测试用例
测试用例
测试结果
测试结果
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.