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 ...
随机推荐
- Asp.Net Core 入门(八)—— Taghelper
Taghelper是一个服务端的组件,可以在Razor文件中创建和渲染HTML元素,类似于我们在Asp.Net MVC中使用的Html Taghelper.Asp.Net Core MVC内置的Tag ...
- python3中bytes、hex和字符串相互转换
1.字符串转bytes a = 'abcd' a1 = bytes(a,encoding('utf-8')) 2.bytes转字符串 a = b'abcd' a1 = bytes.decode(a , ...
- sscanf函数详解
#if 0 ,sscanf():从一个字符串中读进与指定格式相符的数据. ,sscanf与scanf类似,都是用于输入的,只是后者以屏幕(stdin)为输入源,前者以固定字符串为输入源. ,关于正则表 ...
- Hibernate映射文件配置(hbm.xml和注解方式)
一:通过*.hbm.xml配置实体的实现方式 mappingResources用于指定少量的hibernate配置文件像这样 Xml代码 <property name="mappin ...
- 【译】Swift 字符串速查表
[译]Swift 字符串速查表 2015-12-18 10:32 编辑: suiling 分类:Swift 来源:CocoaChina翻译活动 10 5585 Swift字符串 招聘信息: iOS高级 ...
- 基于Vue+VueRouter+ModJS+Fis3快速搭建H5项目总结
技术选型 • 框架 - Vue+VueRouter • 相比较于react/angular/avalon ? • 简单轻量,社区配套完整• 模块化 - ModJS • 相比较于require/seaj ...
- C++系统学习之八:IO库
新的C++标准中有三分之二的内容都是描述标准库.接下来重点学习其中几种核心库设施,这些是应该熟练掌握的. 标准库的核心是很多容器类(顺序容器和关联容器等)和一簇泛型算法(该类算法通常在顺序容器一定范围 ...
- Android Studio问题记录
1>Android Studio中module是什么,? 答:Android Studio是基于intellij,跟eclipse不太一样.对应关系如下: intellij的project -- ...
- 循环链表的C风格实现(单向)
头文件: #ifndef _CIRCLELIST_H_ #define _CIRCLELIST_H_ typedef void CircleList; // typedef struct _tag_C ...
- PAT Basic 1034
1034 有理数四则运算 本题要求编写程序,计算2个有理数的和.差.积.商. 输入格式: 输入在一行中按照“a1/b1 a2/b2”的格式给出两个分数形式的有理数,其中分子和分母全是整型范围内的整数, ...