Given a non-empty string s, you may delete at most one character. Judge whether you can make it a palindrome.

Example 1:

Input: "aba"
Output: True

Example 2:

Input: "abca"
Output: True
Explanation: You could delete the character 'c'.

Note:

  1. The string will only contain lowercase characters a-z. The maximum length of the string is 50000.
class Solution {
public:
bool validPalindrome(string s) {
int i,j;
int si,sj;
int n=s.size();
int count=;
int way=;
for(i=,j=n-;i<j;i++,j--){
if(s[i]==s[j])
continue;
else{
if(way==){
return false;
}
if(way==){
way++;
i=si;
j=sj;
j++;
}
if(way==){
way++;
count=;
si=i;
sj=j;
i--;
}
}
}
return true;
}
};

(判断是否回文)

最新文章

  1. Oracle forall bulk collect批量数据更新
  2. 广义线性模型(Generalized Linear Models)
  3. Android开发之---Activity启动模式
  4. export
  5. VS2012配置Lua环境
  6. 设置MySQL主从同步
  7. CSU1327+贪心+模拟
  8. Jasper_pass data_from main report to subReport (local CSV)
  9. [Redux] Generating Containers with connect() from React Redux (VisibleTodoList)
  10. Facebook Hacker Cup 2015 Round 1--Corporate Gifting(树动态规划)
  11. ajax常用实例代码总结新手向参考(一)
  12. docker 初步使用
  13. swagger访问api, TypeError: Failed to fetch
  14. lunix salt 用法
  15. .Net编译原理简单介绍
  16. List,Set,Map集合的遍历方法
  17. python3.4连接和读取oracle数据表
  18. [JAVA] JAVA 文档注释
  19. angular 封装公共方法
  20. python 这个stdin怎么写

热门文章

  1. Golang之(if)流程控制
  2. centos 安装或更新最新版本软件包(git python etc)的方法 SCL IUS
  3. JS—-this指向
  4. JavaScript 的数据类型及其检测
  5. 20155210 2016-2017-2 《Java程序设计》第7周学习总结
  6. 2018.07.31 POJ1741Tree(点分治)
  7. S3 exercise -- 文件操作&amp;函数
  8. IntelliJ IDEA 2017版 加载springloaded-1.2.4.RELEASE.jar实现热部署
  9. C#操作Excel(创建、打开、读写、保存)几种方法的总结
  10. authentication 和 authorization