当前位置:网站首页>[string] judge whether S2 is the rotation string of S1
[string] judge whether S2 is the rotation string of S1
2022-06-12 03:00:00 【I'm not xiaohaiwa~~~~】
Normal operation
bool isRotation(string s1, string s2)
{
if(s1.length()!=s2.length())
return false;
bool ret=false;
for(int i=0;i<s1.length();i++)
{
string temp=s1.substr(0,i+1);
// cout<<temp<<endl;
string temp2=s1.substr(i+1,(s1.length()-i+1));
// cout<<temp2<<endl;
string str=temp2+temp;
if(str==s2)
{
cout<<str<<endl;
return true;
}
}
return ret;
}
边栏推荐
- 安科瑞抗晃电产品在河北某化工项目的应用
- xml
- How to reduce the complexity of cloud computing infrastructure?
- The market value has exceeded $3trillion. Why should apple, which has been criticized as a loser, rise again and again?
- Kubernetes affinity learning notes
- About 100 to realize the query table? Really? Let's experience the charm of amiya.
- Selection (045) - what is the output of the following code?
- The unique path of leetcode topic resolution II
- 跨域有哪些解决方法?
- $. map(data,function(item,index){return XXX})
猜你喜欢

Infinite loop judgment method;

Comment prévenir les incendies électriques dans les centres commerciaux?

2020-12-06

About 100 to realize the query table? Really? Let's experience the charm of amiya.

(9) Serial port interrupt

ARD3M电动机保护器在煤炭行业中的应用

Demand and business model innovation - demand 8- interview

Solutions to errors in ROM opening by MAME

In 2022, don't you know the difference between arrow function and ordinary function?

Drawcall, batches, setpasscall in unity3d
随机推荐
【点云压缩】Variational Image Compression with A Scale Hyperprior
RPC 入门
No writing, please forgive me
ARD3M电动机保护器在煤炭行业中的应用
Wechat applet project example - renju for two
跨域有哪些解决方法?
DbNull if statement - DbNull if statement
推荐6款办公软件,好用还免费,效率翻倍
ZABBIX notes: 6.0 lts source code installation
2020-12-06
How to build urban smart bus travel? Quick code to answer
Selection (046) - what is the output of the following code?
分数大小的比较
Wechat applet project example - Fitness calculator
Recommend 6 office software, easy to use and free, double the efficiency
Laravel 8 selects JWT for interface verification
微信小程序项目实例——体质计算器
Demand and business model innovation - demand 9- prototype
errno: -4091, syscall: ‘listen‘, address: ‘::‘, port: 8000
Unity3D中DrawCall、Batches、SetPassCall