当前位置:网站首页>Double pointer palindrome string
Double pointer palindrome string
2022-06-30 14:37:00 【Douglas_ LT】
A daily topic ing, Today is a day easy topic 680. Valid Palindrome II
class Solution {
public:
static bool checkPalindrome(string s,int low,int high){
for(int i=low,j=high;i<j;i++,j--){
if(s[i]!=s[j]){
return false;
}
}
return true;
}
bool validPalindrome(string s) {
int i=0,j=s.size()-1;
while(i<j){
if(s[i]!=s[j]){
return checkPalindrome(s,i,j-1)||checkPalindrome(s,i+1,j);
}
else{
i++;j--;
}
}
return true;
}
};
边栏推荐
- Attack and defense world web questions
- NoViableAltException([email protected][])
- org.json.JSONObject对象转json,json新增元素,根据json的key获取值。以及list对象格式字符串转jsonArray
- Fastcgi CGI shallow understanding
- MV3 04_ Introducing Manifest V3
- @Role of ResponseBody
- Ctfshow getting started with the web (ThinkPHP topic)
- How to use Alibaba Vector Icon
- Mutex lock, read / write lock, spin lock, pessimistic lock, and optimistic lock
- 【BUUCTF】[GXYCTF2019]Ping Ping Ping1
猜你喜欢

【BUUCTF】 EasySql

After the MySQL service on the local computer is started and stopped, some services will automatically stop when they are not used by other services or programs

How to realize selective screen recording for EV screen recording

Summary of use of laravel DCAT admin

Go language mutex lock

Attack and defense world web questions

I love network security for new recruitment assessment

【BUUCTF】 Have Fun

The first three passes of sqli Labs

Zend studio how to import an existing project
随机推荐
val_ Loss decreases first and then increases or does not decrease but only increases
Advanced usage of go language for loop break and continue
Getting started with shell Basics
Realize a simple LAN communication (similar to feiqiu)
从控制层返回到js的json数据带“\”转译符,怎么去掉
Notepad regular delete the line of the keyword
[buuctf] [actf2020 freshman competition]include
Jetpack compose for perfect screen fit
数据恢复软件EasyRecovery15下载
[buuctf] [actf2020 freshman competition]exec1
Impersonate server and client using message queuing
[extensive reading of papers] a delicious recipe analysis framework for exploring multi modal recipes with variable attributes
ot initialized – call ‘refresh’ before invoking lifecycle methods via the context: Root WebApplicati
Initial attack and defense world Misc
PS tip: the video frame to Layer command cannot be completed because dynamiclink is not available
Solve the error in my QT_ thread_ global_ End(): 3 threads didn't exit
Lost connection to the flow server (0 retries remaining): |Out of retries, exiting! Error reporting solution (flow)
Geoffreyhinton: my 50 years of in-depth study and Research on mental skills
I love network security for new recruitment assessment
PHP recursive multi-level classification, infinite classification