当前位置:网站首页>Force buckle 459 Duplicate substring
Force buckle 459 Duplicate substring
2022-07-07 20:06:00 【Tomorrowave】
459. Repeated substrings
Given a non empty string s , Check whether it can be formed by repeating one of its substrings multiple times .
Example 1:
Input : s = “abab”
Output : true
explain : But by substring “ab” Repeat twice to form .
Ideas :
First, construct a string of arbitrary length to match another string , Traversal extraction string , Meet or not meet the conditions , You can traverse the parent string in the main function
Code section
class Solution:
def isPrefixMultiple(self,s:str,lengh):
cnt=len(s)//lengh
for i in range(cnt):
for j in range(lengh):
if s[i*lengh+j]!=s[j]:
return False
return True
def repeatedSubstringPattern(self, s: str) -> bool:
nn=len(s)
for i in range(1,nn):
if nn%i==0:
if self.isPrefixMultiple(s,i):
return True
return False
边栏推荐
- [RT thread env tool installation]
- 831. KMP string
- CUDA versions are inconsistent, and errors are reported when compiling apex
- el-upload上传组件的动态添加;el-upload动态上传文件;el-upload区分文件是哪个组件上传的。
- Nunjuks template engine
- Cloud 组件发展升级
- 吞吐量Throughout
- Le PGR est - il utile au travail? Comment choisir une plate - forme fiable pour économiser le cœur et la main - d'œuvre lors de la préparation de l'examen!!!
- 力扣599. 两个列表的最小索引总和
- 线性基
猜你喜欢
![[RT thread env tool installation]](/img/bc/9b39651d40a240f0893200793f67e9.png)
[RT thread env tool installation]

PMP對工作有益嗎?怎麼選擇靠譜平臺讓備考更省心省力!!!

mysql 的一些重要知识

使用高斯Redis实现二级索引

el-upload上传组件的动态添加;el-upload动态上传文件;el-upload区分文件是哪个组件上传的。

Automatic classification of defective photovoltaic module cells in electroluminescence images-論文閱讀筆記

ASP. Net learning & ASP's one word

编译器优化那些事儿(4):归纳变量
让这个 CRMEB 单商户微信商城系统火起来,太好用了!

Implement secondary index with Gaussian redis
随机推荐
R language ggplot2 visualization: use the ggecdf function of ggpubr package to visualize the grouping experience cumulative density distribution function curve, and the linetype parameter to specify t
干货分享|DevExpress v22.1原版帮助文档下载集合
关于自身的一些安排
Cloud 组件发展升级
R language ggplot2 visualization: use the ggviolin function of ggpubr package to visualize the violin diagram, set the palette parameter to customize the filling color of violin diagrams at different
R语言ggplot2可视化:使用ggpubr包的ggviolin函数可视化小提琴图、设置palette参数自定义不同水平小提琴图的填充色、add参数在小提琴图添加箱图
如何在软件研发阶段落地安全实践
841. String hash
R language dplyr package mutate_ At function and min_ The rank function calculates the sorting sequence number value and ranking value of the specified data column in the dataframe, and assigns the ra
R language ggplot2 visualization: use the ggstripchart function of ggpubr package to visualize the dot strip plot, set the position parameter, and configure the separation degree of different grouped
力扣 989. 数组形式的整数加法
Make this crmeb single merchant wechat mall system popular, so easy to use!
pom.xml 配置文件标签:dependencies 和 dependencyManagement 区别
R language ggplot2 visualization: use the ggdensity function of ggpubr package to visualize the packet density graph, and use stat_ overlay_ normal_ The density function superimposes the positive dist
【Confluence】JVM内存调整
【Auto.js】自动化脚本
LC: string conversion integer (ATOI) + appearance sequence + longest common prefix
九章云极DataCanvas公司获评36氪「最受投资人关注的硬核科技企业」
华南X99平台打鸡血教程
Mysql, sqlserver Oracle database connection mode