/**********************************************************************************************************

描述
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.
Note: Have you consider that the string might be empty? is is a good question to ask during an
interview.
For the purpose of this problem, we define empty string as valid palindrome   
**********************************************************************************************************/

class Solution{
public:bool isPalindrome(string s){tranform(s.begin(),s.end(),s.begin(),::tolower);auto left = s.begin(), right = prev(s.end());while(left < right){if(!::isalnum(*left)) ++left;else if(!::isalnum(*right)) ++right;else if(*left != *right) return false;}return true;}
};

参考资料:

LeetCode题解

字符串 -- 3.1 Valid Palindrome -- 图解相关推荐

  1. 【LeetCode 剑指offer刷题】字符串题12:Valid Palindrome(回文词系列)

    [LeetCode & 剑指offer 刷题笔记]目录(持续更新中...) Valid Palindrome Given a string, determine if it is a pali ...

  2. 验证字符串是否回文 Valid Palindrome

    为什么80%的码农都做不了架构师?>>>    问题: Given a string, determine if it is a palindrome, considering on ...

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

    版权声明:转载请联系本人,感谢配合!本站地址:http://blog.csdn.net/nomasp https://blog.csdn.net/NoMasp/article/details/5062 ...

  4. [LeetCode] Palindrome Number Valid Palindrome - 回文系列问题

    题目概述: Determine whether an integer is a palindrome. Do this without extra space. 题目分析: 判断数字是否是回文 例如1 ...

  5. Leet Code OJ 125. Valid Palindrome [Difficulty: Easy]

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

  6. valid Palindrome -- leetcode

    125 Valid Palindrome Given a string, determine if it is a palindrome, considering only alphanumeric ...

  7. LeetCode 125. Valid Palindrome

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

  8. C#LeetCode刷题之#125-验证回文串(Valid Palindrome)

    问题 该文章的最新版本已迁移至个人博客[比特飞],单击链接 https://www.byteflying.com/archives/3899 访问. 给定一个字符串,验证它是否是回文串,只考虑字母和数 ...

  9. 125 Valid Palindrome

    125 Valid Palindrome 链接:https://leetcode.com/problems/valid-palindrome/ 问题描写叙述: Given a string, dete ...

  10. leetcode python3 简单题125. Valid Palindrome

    1.编辑器 我使用的是win10+vscode+leetcode+python3 环境配置参见我的博客: 链接 2.第一百二十五题 (1)题目 英文: Given a string, determin ...

最新文章

  1. 方法 注释_注释模板导入操作方法
  2. sql server中的hash应用优化
  3. AI真人表情包、斗地主AI......DeeCamp学员做了50个好玩又实用的AI项目
  4. ASP的DES加密解密
  5. 白色flash模块代码_适用于MCU项目的代码框架BabyOS,工程师的好助手!
  6. 广元南山隧道南河互通立交图_广元城区一隧道工程竣工时间已定,今后出行更加方便了!...
  7. 【HDU - 5700】【51nod - 1672】 区间交(贪心,STLset 或线段树第k大)
  8. vue项目导入elementui_在vue项目中使用elementui
  9. JimuReport积木报表 — API数据源报表带参制作
  10. Java基础——0 前言
  11. python 通过js控制滚动条拉取全文 通过psutil获取pid窗口句柄,通过win32gui使程序窗口前置 通过autopy实现右键菜单和另存为操作...
  12. linux的telnet
  13. 小米4 win10 刷回android,小米4怎么从win10刷回MIUI 小米4 win10刷回MIUI系统详细教程...
  14. 深入理解Binder机制1-AIDL原理
  15. 杰奇2.4珊瑚模板简繁转换出现乱码怎么解决
  16. 剑指Offer面试题11(Java版):数值的整数次方
  17. PS电商插件/图牛助理插件/多模板电商工具/Adobe Photoshop CC 2015-2022可直接使用的ps插件
  18. week1:History: Dawn of Electronic Computing
  19. Git 分支合并情况
  20. 什么是 NFT 洗盘交易:洗盘交易背后的原理

热门文章

  1. 1020 月饼 (25 分)—PAT (Basic Level) Practice (中文)
  2. 【Go】使用压缩文件优化io (二)
  3. 移动端向上滑动整个屏幕
  4. 微信小程序 点击复制文本到剪贴板
  5. eclipse修改java编译的版本
  6. 世界是数字的读后感:
  7. alter table move
  8. 没事学学docker(三):配置阿里云镜像加速以及解决docker起不来的问题
  9. HW 静态路由实现PC间互通
  10. 2018上海大学生网络安全赛 misc 92 wp