LeetCode OJ--Valid Palindrome
http://oj.leetcode.com/problems/valid-palindrome/
判断是否为回文串
bool isPalindrome(string s) {
int i = ,j = s.length() -;
int flag = ; if(s=="")
return true; while(i<=j)
{
while(!('a'<= s[i] && s[i]<= 'z' || 'A' <= s[i] && s[i] <='Z' || s[i]>= ''&&s[i]<='') || s[i] == ' ' )
{
if(i== s.length())
break;
i++;
}
while(!('a'<= s[j] && s[j]<= 'z' || 'A' <= s[j] && s[j] <='Z' || s[j]>= ''&&s[j]<='') || s[j] == ' ')
{
if(j==)
break;
j--;
}
if(toupper(s[i]) != toupper(s[j]) && i<=j)
{
flag = ;
break;
}
i++;
j--;
}
if(flag == )
return false;
else
return true;
}
LeetCode OJ--Valid Palindrome的更多相关文章
- [LeetCode] 680. Valid Palindrome II 验证回文字符串 II
Given a non-empty string s, you may delete at most one character. Judge whether you can make it a pa ...
- [Leetcode][JAVA] Valid Palindrome
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignori ...
- [leetcode] 1. Valid Palindrome
leetcode的第一题,回文数判断. 原题如下: For example, "A man, a plan, a canal: Panama" is a palindrome. & ...
- LeetCode 1216. Valid Palindrome III
原题链接在这里:https://leetcode.com/problems/valid-palindrome-iii/ 题目: Given a string s and an integer k, f ...
- [LeetCode] 125. Valid Palindrome 验证回文字符串
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignori ...
- 【leetcode】Valid Palindrome
题目简述: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ...
- 【题解】【字符串】【Leetcode】Valid Palindrome
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignori ...
- leetcode 125. Valid Palindrome ----- java
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignori ...
- LeetCode 125. Valid Palindrome
这个题目只要注意大小写问题即可解决,而且我们只关注的是字母和数值 Given a string, determine if it is a palindrome, considering only a ...
- leetcode:Valid Palindrome
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignori ...
随机推荐
- java POI技术之导出数据优化(15万条数据1分多钟)
专针对导出excel2007 ,用到poi3.9的jar package com.cares.ynt.util; import java.io.File; import java.io.FileOut ...
- javascript基本数据类型问题汇总
isNaN()检测是否是NaN: 比较浮点相等,用绝对值,是否小于某一个阈值 Math.abs(1/3 - (1-2/3))<0.0000001: 字符串多行显示\n,ES6中使用反引号``: ...
- ios之UISegmentedcontol
初始化UISegmentedControl NSArray *arr = [[NSArray alloc]initWithObjects:@"轻拍",@"长按" ...
- HashMap允许将null用作键 也允许将null作为值
HashMap不能保证元素的顺序,HashMap能够将键设为null,也可以将值设为null. 与之对应的是Hashtable,(注意大小写:不是HashTable),Hashtable不能将键和值设 ...
- Controller View 模式
参考:https://blog.andrewray.me/the-reactjs-controller-view-pattern/ Flux参考:http://www.cnblogs.com/hell ...
- clipboard 在 vue 中的使用
简介 页面中用 clipboard 可以进行复制粘贴,clipboard能将内容直接写入剪切板 安装 npm install --save clipboard 使用方法一 <template&g ...
- ES5中新增的forEach等新方法的一些使用声明
转载地址:http://www.zhangxinxu.com/wordpress/?p=3220 一.前言-索引 ES5中新增的不少东西,了解之对我们写JavaScript会有不少帮助,比如数组这块, ...
- 杭电 1051 Wooden Sticks
Description There is a pile of n wooden sticks. The length and weight of each stick are known in adv ...
- mac下secureCRT 客户端 $redis-cli回车后没有反应的解决办法
启动redis server后,SecureCRT进入redis-cli,输入不断在后面追加IP:Port显示设置当前的Session Options-->Terminal-->Emula ...
- Sequence Models
Sequence Models This is the fifth and final course of the deep learning specialization at Coursera w ...