public class Solution {
public boolean isPalindrome(String s) {
if(s==null)
return false;
s=s.toLowerCase();
for(int i =0,j=s.length()-1;i<=j;i++,j--){
while(!isAlpha(s.charAt(i))&&!isNum(s.charAt(i))){
i++;
if(i>j)
break;
} while(!isAlpha(s.charAt(j))&&!isNum(s.charAt(j))){
j--;
if(i>j)
break;
} if(i<=j){
if(s.charAt(i)!=s.charAt(j)){
return false;
}
} }
return true;
}
public boolean isAlpha(char a){
if((a >= 'a' && a <= 'z') || (a >= 'A' && a <= 'Z')){
return true;
}else{
return false;
}
} public boolean isNum(char a){
if(a >= '0' && a <= '9'){
return true;
}else{
return false;
}
}
}

125 Valid Palindrome的更多相关文章

  1. 125. Valid Palindrome【easy】

    125. Valid Palindrome[easy] Given a string, determine if it is a palindrome, considering only alphan ...

  2. [LeetCode]题解(python):125 Valid Palindrome

    题目来源 https://leetcode.com/problems/valid-palindrome/ Given a string, determine if it is a palindrome ...

  3. leetcode 125. Valid Palindrome ----- java

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

  4. LeetCode 125. Valid Palindrome

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

  5. Java [Leetcode 125]Valid Palindrome

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

  6. 【LeetCode】125. Valid Palindrome

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

  7. 【一天一道LeetCode】#125. Valid Palindrome

    一天一道LeetCode 本系列文章已全部上传至我的github,地址:ZeeCoder's Github 欢迎大家关注我的新浪微博,我的新浪微博 欢迎转载,转载请注明出处 (一)题目 Given a ...

  8. [leetcode]125. Valid Palindrome判断回文串

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

  9. LeetCode 125 Valid Palindrome(有效回文)(*)

    翻译 给定一个字符串.确定它是否是回文的,仅仅考虑当中的数字和字符并忽略其它. 比如. "A man, a plan, a canal: Panama" 是回文的. "r ...

  10. 125. Valid Palindrome (Array; Two-Pointers)

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

随机推荐

  1. 0525 SCRUM项目7.0

    主题:在下一个SPRINT中做的更好 一,实验回顾总结 当谈到在一个团队里的收获,首当其冲的便是对于团队工作流程的切身体会.亲力亲为.从申报材料.问卷设计.访谈提纲.团队建设.书签制作到实地访谈.问卷 ...

  2. PIC32MZ tutorial -- Timer Interrupt

    An interrupt is an internal or external event that requires quick attention from the controller. The ...

  3. 初学javaweb,远离各自框架

    OSCHINA 软件库有一个分类--Web框架,该分类中包含多种编程语言的将近500个项目. Web框架是开发者在使用某种语言编写Web应用服务端时关于架构的最佳实践.很多Web框架是从实际的Web项 ...

  4. 关于对 maximio平台的五个常用类的初步理解及总结

    AppBean:绑定应用的默认Bean类,控制主对象集/单个对象,和ui关联的类 继承:DataBean DataBean:任何对象集/单个对象,在ui端处理类. 1.在对象层:写一个Fld类,调用构 ...

  5. Reprot中的五个Trigger说明

    Report Trigger 1.1 Which report trigger to use As a general rule, any processing that will affect th ...

  6. 在Egret实现二维码长按识别

      Egret中二维码图片,是在canvas上,无法在微信上长按扫描识别. 由于微信长按识别二维码是截屏扫描原理,所以只要长按当前屏幕任意一张图片,都能够识别当前屏幕上的二维码. 这里把二维码放在ex ...

  7. A potentially dangerous Request.Form value was detected from the client

    提交表单中包含特殊字符如<script>可能被认为是跨站攻击代码:解决方法很多,如stackoverflow上的web.config中加设置的方法不中肯[如原贴中Jamie M所说],主要 ...

  8. 控件的相对位置与绝对位置-UI界面编辑器(SkinStudio)教程

    绝对位置: 相对位置: 相对位置配合Anchor属性使用 例如Anchor属性选择left|top(即相对位置的left和top保持不变) 窗口大小改变前: 窗口大小改变后: 可以看到控件相对位置的l ...

  9. Multipart to single part feature

    Multipart to single part feature Explode Link: http://edndoc.esri.com/arcobjects/8.3/?URL=/arcobject ...

  10. 修改win10打开文件资源管理器