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的更多相关文章

  1. [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 ...

  2. [Leetcode][JAVA] Valid Palindrome

    Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignori ...

  3. [leetcode] 1. Valid Palindrome

    leetcode的第一题,回文数判断. 原题如下: For example, "A man, a plan, a canal: Panama" is a palindrome. & ...

  4. LeetCode 1216. Valid Palindrome III

    原题链接在这里:https://leetcode.com/problems/valid-palindrome-iii/ 题目: Given a string s and an integer k, f ...

  5. [LeetCode] 125. Valid Palindrome 验证回文字符串

    Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignori ...

  6. 【leetcode】Valid Palindrome

    题目简述: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ...

  7. 【题解】【字符串】【Leetcode】Valid Palindrome

    Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignori ...

  8. leetcode 125. Valid Palindrome ----- java

    Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignori ...

  9. LeetCode 125. Valid Palindrome

    这个题目只要注意大小写问题即可解决,而且我们只关注的是字母和数值 Given a string, determine if it is a palindrome, considering only a ...

  10. leetcode:Valid Palindrome

    Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignori ...

随机推荐

  1. 1658: Easier Done Than Said?

    1658: Easier Done Than Said? Time Limit: 1 Sec  Memory Limit: 64 MBSubmit: 15  Solved: 12[Submit][St ...

  2. C01 C语言基础

    目录 C语言简史及特点 C语言开发环境 C语言程序结构 C语言基本输入输出函数 编译 软件类型 C语言简要及特点 什么是计算机语言 计算机语言是用于人与计算机之间通讯的语言. 计算机遵照接收到的计算机 ...

  3. HTML5拖放(drag和drog)

    拖放(drag和drog)是HTML5的标准的组成部分,也是种常见的特性,意义为抓起一个元素放入到另外的一个位置,在HTML5中任何元素都可以被拖放,前题是要相关进行设置. 1.设置元素为可拖放,也就 ...

  4. [LUOGU] P1111 修复公路

    题目背景 A地区在地震过后,连接所有村庄的公路都造成了损坏而无法通车.政府派人修复这些公路. 题目描述 给出A地区的村庄数N,和公路数M,公路是双向的.并告诉你每条公路的连着哪两个村庄,并告诉你什么时 ...

  5. PHP调用新浪API 生成短链接

    我们经常收到类似于这样的短信(如下图),发现其中的链接并不是常规的网址链接,而是个短小精悍的短链接,产品中经常需要这样的需求,如果在给用户下发的短信中是一个很长的连接,用户体验肯定很差,因此我们需要实 ...

  6. (61)zabbix网络发现规则配置实战/详解

    开始配置.首先,我们需要定义发现规则,用于扫描.步骤如下 第一步 Configuration >>Discovery>>Create rule,编辑网络发现规则 如上配置,za ...

  7. (48)zabbix报警媒介:自定义脚本Custom alertscripts

    自定义脚本媒介.zabbix会将信息传递给脚本,接下来你在脚本里面随意处理,一共会传递三个参数,按顺序接受也就是$1,$2,$3了,为了方便记忆,一般分别给他们赋值到To\Subject\body 配 ...

  8. centos 7 中文乱码的解决办法

    @@首先查看系统的操作版本,我的版本是centos 7.2 的. @@查看系统是否有安装中文语言包,一般我们在安装的时候系统都会默认的为我们安装上去的. locale -a | grep " ...

  9. 蓝牙学习(2)USB Adapter

    主要分析一下蓝牙USB Adapter使用USB接口传输HCI包的实现及过程. 参照上面的Bluetooth core system architecture图, 蓝牙USB Adapter作为Blu ...

  10. Processed foods make us fatter easily

    From Business Insider Here's an experiment: sit alone in a hospital room for two weeks and eat nothi ...