LeetCode - Valid Palindrome
来源:互联网 发布:歼20 歼31 知乎 编辑:程序博客网 时间:2024/03/29 08:26
通过Large Judge还挺不容易
public class Solution { public boolean isPalindrome(String s) { int i=0, j=s.length()-1; while (i < j) { char ci=' ', cj=' '; while (i<j && !isLegit(ci = s.charAt(i))) i++; while (i<j && !isLegit(cj = s.charAt(j))) j--; if (i<j && !isSame(ci, cj)) return false; i++; j--; } return true; } private boolean isLegit(char c) { if (c>='A'&&c<='Z' || c>='a'&&c<='z' || c>='0'&&c<='9') return true; else return false; } private boolean isSame(char ci, char cj) { int diff = (int)(ci-cj); if (Math.abs(diff)==32 || diff==0) return true; else return false; }}
- [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
- 精心挑选的12款优秀 jQuery 手风琴效果插件和教程
- Android 滑动效果入门篇(一)—— ViewFlipper
- ubuntu12.04使用---在左侧桌面添加图标
- 改变窗体形状
- 用setsockopt()来控制recv()与send()的超时
- LeetCode - Valid Palindrome
- 不能访问SD卡的情况
- android AsyncTask介绍
- 数据库Sharding的基本思想和切分策略
- Combinations
- linux shell数据重定向(输入重定向与输出重定向)详细分析
- 【Git项目管理】W access DENIED Problem解决方法
- 使用SecureCRT来传输数据
- struts2 + extjs3.4 中使用kindeditor4.1.4实现上传功能