leetcode---Valid Palindrome
来源:互联网 发布:mac 命令行安装wget 编辑:程序博客网 时间:2024/06/16 18:43
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
For example,
“A man, a plan, a canal: Panama” is a palindrome.
“race a car” is not a palindrome.
class Solution {public: bool isPalindrome(string s) { char ss[100000]; int len = s.length(); int index = 0; for(int i=0; i<len; i++) { if(isalpha(s[i])) ss[index++] = toupper(s[i]); if(isdigit(s[i])) ss[index++] = s[i]; } int l = 0; int r = index - 1; while(l < r) { if(ss[l] != ss[r]) return false; l++; r--; } return true; }};
0 0
- [Leetcode] Valid Palindrome
- Leetcode: Valid Palindrome
- leetcode 55: Valid Palindrome
- [LeetCode] Valid Palindrome
- 【leetcode】Valid Palindrome
- LeetCode - Valid Palindrome
- [leetcode]Valid Palindrome
- [LeetCode]Valid Palindrome
- [Leetcode]Valid Palindrome
- LeetCode-Valid Palindrome
- [leetcode] Valid Palindrome
- LeetCode 125: Valid Palindrome
- LeetCode - Valid Palindrome
- leetcode之Valid Palindrome
- LeetCode | Valid Palindrome
- [leetcode]Valid Palindrome
- 【leetcode】Valid Palindrome
- LeetCode题解:Valid Palindrome
- CentOS 7卸载openjdk
- Land oj 1604 - Play Apple (博弈)
- [Web API] Client 指定請求及回應格式(xml/json)
- Android利用Cookie实现码源登录效果二
- 解决Ubuntu下chrome总是在Dock上留两个图标
- leetcode---Valid Palindrome
- 第七课 可执行程序的装载(2)
- 1005 hdoj Number Sequence (java函数格式)
- 记录一次Centos7下php无法连接redis
- C语言循环数组做FIFO队列--一些认识
- android多线程下载
- bestcoder 79 Claris and XOR
- CUDA编程(十)使用Kahan's Summation Formula提高精度
- hdu3007(最小覆盖圆问题)