当前位置:网站首页>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;
}
};
边栏推荐
- Google Earth engine (GEE) - ghsl: global human settlements layer, built grid 1975-1990-2000-2015 (p2016) data set
- Introduction to the construction and development of composer private warehouse
- Summary of FTP network protocol learning
- Problem: wechat developer tool visitor mode cannot use this function
- [buuctf] [actf2020 freshman competition]exec1
- @Role of ResponseBody
- Notepad regular delete the line of the keyword
- Thoughts on the security of a PHP file name regular verification
- Invalid argument during startup: Failed to open the . conf file: redis-window
- Impersonate server and client using message queuing
猜你喜欢

Ctfshow getting started with the web (ThinkPHP topic)

Querywrapper in mybaits plus

【BUUCTF】 Have Fun

KnightCTF WEB

Thinkphp5 log file contains trick

Upgrade centos7 mysql5.5 to mysql5.7 non RPM in the form of tar package

XSS challenge (6-10) more detailed answers

Why does the folder appear open in another program

JS to realize simple lottery function
![[buuctf] [geek challenge 2019] secret file](/img/00/23bebd013eb4035555c0057725e3c4.jpg)
[buuctf] [geek challenge 2019] secret file
随机推荐
Fastcgi CGI shallow understanding
LIS error: this configuration section cannot be used in this path
Go common lock mutex and rwmutex
Problems in QT creator (additional unknown and error lines are listed in the debug output window)
Realize a simple LAN communication (similar to feiqiu)
PS dynamic drawing
Advanced usage of go language for loop break and continue
Wechat applet realizes map navigation + door-to-door recycling
PHP common authentication / third-party methods
Invalid argument during startup: Failed to open the . conf file: redis-window
Introduction to the construction and development of composer private warehouse
The difference between settimeout() and setinterval()
How does hbuilder display in columns?
Impersonate server and client using message queuing
Laravel configures passport and returns token using JWT
Detailed explanation of the first three passes of upload Labs
LeetCode_ Stack_ Medium_ 227. basic calculator II (without brackets)
Experiment 2: stack
Initial attack and defense world Misc
Comprehensively analyze the basic features and summary of free and paid SSH tools