Valid Palindrome

[leetcode]Valid Palindrome (判断回文数 C语言实现) Valid Palindrome 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 阅读详情

Valid Palindrome

  Total Accepted: 22728  Total Submissions: 99271 My Submissions

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.


public class Solution {
    public boolean isPalindrome(String s) {
        if (s == null) {
            return false;
        }
        if (s.length() == 0 || s.length() == 1) {
            return true;
        }
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < s.length();i++){
            Character ch = s.charAt(i);
	            if(Character.isLetter(ch) || Character.isDigit(ch)){
                sb.append(Character.toUpperCase(ch));

            } else {
                continue;
            }
        }
        int start = 0 ;
        int end = sb.length() - 1;
        while ( start < end) {
            if (sb.charAt(start) == sb.charAt(end)) {
                start ++;
                end --;
            } else {
                return false; 
            }
        }
        return true;
     }
}

这个题目的问题在于刚开始的时候没有考虑到可能是数字的情况,题目本身没有难度。
【GetShell】n8n 未授权远程代码执行漏洞(CVE-2026-21858 + CVE-2025-68613) 本文详细解析n8n未授权远程代码执行漏洞组合利用链(CVE-2026-21858 + CVE-2025-68613)。两个独立漏洞看似危害有限,组合后可实现全程零权限 GetShell:通过未授权任意文件读取窃取加密密钥和管理员数据库,利用令牌签名算法缺陷伪造永久登录凭证,绕过鉴权后借助表达式沙箱逃逸实现系统命令执行,最终绕过 Shell 解析坑成功反弹交互式 Shell。 文章包含靶场搭建、全链路复现步骤、关键踩坑细节及一键利用脚本,完整还原攻击全过程。本文仅用于合法安全研究与教育目的,请勿用于未授权测试 阅读详情

相关推荐

FFmpeg视频缩放终极指南:从基础命令到保持宽高比的5种实战技巧

本文是FFmpeg视频缩放的终极指南,详细讲解了从基础命令到保持宽高比的5种实战技巧。针对不同平台(如抖音、B站、Instagram)的分辨率要求,提供了具体的参数模板和批量处理脚本,帮助内容创作者高效、精准地调整视频大小,避免画面变形或黑边问题,实现多平台适配。

juice的博客 477

Valid Palindrome 是一道好题

这是一道好题,值得自己反思。 现在先睡觉。 祝好!

sjphiChina的博客 333

【经验分享】使用Keil5烧录代码遇到的问题及解决方法

本文介绍了在使用Keil5烧录代码过程中可能遇到的常见问题,主要为编译错误和下载失败,并提供了解决方案和注意事项。通过本文中提供的具体解决方案和注意事项,希望能够帮助读者更加顺利地进行Keil5烧录代码操作,提高开发效率和成果实现。

qq_63195670的博客 1万+

LeetCode--125. Valid Palindrome

题目链接:https://leetcode.com/problems/valid-palindrome/ 这是一道很简单平常的问题,但是非常的恶心,提交了6次才AC,主要是对alphanumeric characters的理解,它的定义参考https://whatis.techtarget.com/definition/alphanumeric-alphameric。知晓了这个定义就十分轻松了,...

To_be_thinking的博客 155

Nginx配置Cookie安全属性:HttpOnly、Secure、SameSite实战指南

Cookie是Web应用中维持用户状态的核心机制,其安全配置直接关系到会话管理与身份认证的可靠性。从原理上讲,HttpOnly属性可防止XSS攻击窃取Cookie,Secure属性确保Cookie仅在HTTPS加密连接中传输,而SameSite属性则用于控制跨站请求时Cookie的发送行为,能有效防御CSRF攻击。这些安全属性的技术价值在于构建纵深防御体系,提升应用的整体安全性。在现代浏览器(如Chrome 80+)默认将未明确声明的Cookie视为SameSite=Lax的背景下,正确配置这些属性变得尤为

weixin_33783283的博客 333

数字IC后端设计实现之Innovus POD V2 Flow性能优化全解析

本文深入解析了数字IC后端设计中的Innovus POD V2 Flow性能优化方案。该流程通过整合place_opt_design与clock_opt_design命令,实现了布局与时钟树的协同优化,有效提升了时序收敛效率、改善了设计密度与拥塞,并显著减少了迭代次数,是应对先进工艺复杂设计的关键利器。

ik6789012的博客 1281

LeetCode 125. Valid Palindrome

LeetCode 125. Valid Palindrome Description Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring other cases. For example, “A man, a plan, a cana

Vimer.Bai的博客 233

保姆级教程:用Python脚本一键把选股结果导入通达信自选股(附完整代码)

本文提供了一份详细的Python自动化教程,教你如何将选股结果一键导入通达信自选股。通过解析通达信文件结构、编写Python脚本实现股票代码转换和批量导入,大幅提升量化交易效率。教程包含完整代码示例,特别适合使用通达信(TDX)的投资者和量化交易开发者。

weixin_30915951的博客 368

【Leetcode_easy】680. Valid Palindrome II

problem 680.Valid Palindrome II solution: 不理解判断函数中的节点的问题。。。 class Solution { public: bool validPalindrome(string s) { int left = 0, right = s.size()-1; while(left<rig...

weixin_30685047的博客 168

AltiumDesigner 高效封装库管理 -- samacsys插件实战指南

本文详细介绍了如何利用samacsys插件高效管理AltiumDesigner封装库。通过实战指南,指导用户完成插件安装、云端元件搜索与放置,并分享将海量资源整合为个人标准库的管理策略,从而大幅提升PCB设计效率与可靠性,杜绝封装错误。

weixin_28285943的博客 130

弹窗提示报错: F:\c\CFX5\bin\Debug\net9.0-windows10.0.26100.0\CFX5.dll 面向无法动态枚举工具箱项目的平台...如何解决?

🏆本文收录于 《全栈Bug调优(实战版)》 专栏,该专栏专注于分享我在真实项目开发中遇到的各类疑难Bug及其深层成因,并系统提供高效、可复现的解决思路和实操方案。无论你是刚入行的新手开发者,还是拥有多年项目经验的资深工程师,本专栏都将为你提供一条系统化、高质量的问题排查与优化路径,助力你加速成长,攻克技术壁垒,迈向技术价值最大化与职业发展的更高峰🚀!

**My Coding Family** 959

LeetCode: 125. Valid Palindrome

LeetCode: 125. Valid Palindrome 题目描述 Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example: &quot;A man, a plan, a canal: Panama&quot; is ...

杨领well的专栏 700

12、认知地图的建模与学习

本博客系统介绍了认知地图的定义、背景及其在机器智能领域的应用,重点探讨了模糊认知地图(FCMs)的建模方法与优势。文章还对比分析了几种主流的认知地图模型(如Axelrod模型、Kosko模型等),并讨论了模型的稳定性条件及实际应用前景。通过智能制造和医疗诊断的具体案例,展示了认知地图在复杂因果推理中的强大能力,并提出了模型优化方向与未来研究展望。

plant的博客 225

125. Valid Palindrome*

125. Valid Palindrome* https://leetcode.com/problems/valid-palindrome/ 题目描述 Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. Note: For the ...

珍妮的选择的博客 240

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

[leetcode]125. Valid Palindrome

[leetcode]125. Valid Palindrome Analysis 周五啦周五啦,网上买的小南瓜到啦—— [六一快乐,嘻嘻~] Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. Note: Fo...

weixin_32135877的博客 131

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

LeetCode刷题:125. Valid Palindrome

LeetCode刷题:125. Valid Palindrome 原题链接:https://leetcode.com/problems/valid-palindrome/ Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. N...

梅森上校的博客 业精于勤荒于嬉,形成于思毁于随。 188

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

[Leetcode] 125. Valid Palindrome

Problems: https://leetcode.com/problems/valid-palindrome/ Solution: class Solution { public boolean isPalindrome(String s) { // 将字符小写化 String ls = s.toLowerCase(); // 删除不是数字/字...

Renoler的博客 115

[leetcode]验证回文串(Valid Palindrome)

验证回文串(Valid Palindrome) 给定一个字符串,验证它是否是回文串,只考虑字母和数字字符,可以忽略字母的大小写。 说明:本题中,我们将空字符串定义为有效的回文串。 示例 1: 输入: "A man, a plan, a canal: Panama" 输出: true 示例 2: 输入: "race a car" 输出: false 原题链接:https://le...

gcn_Raymond的博客 337

125 Valid Palindrome

题目链接:https://leetcode.com/problems/valid-palindrome/题目:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example, "A man, a plan, a canal:

再见了,过去的名字,新的奋斗开始啦! 1581

【leetcode】125. Valid Palindrome

125.Valid Palindrome Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. Note:For the purpose of this problem, we define empty string as v...

lemonade13的博客 125

【leeetcode】125-Valid Palindrome

problem 125.Valid Palindrome 参考 1. Leetcode_Valid Palindrome; 完 转载于:https://www.cnblogs.com/happyamyhope/p/10060604.html

weixin_30341745的博客 88

LeetCode //C - 680. Valid Palindrome II

【代码】LeetCode //C - 680. Valid Palindrome II。

Made in Code 1640

leetcode 125. Valid Palindrome

leetcode 125. Valid Palindrome 题目大意:判断一句话时候为回文,只考虑字母,忽略大小写。 解题思路: 1、判断一个字符是否为数字或者字母 2、在比较的时候不分大小写,因此大写直接全部转为小写 3、在判断回文时直接比较首尾的两个字符

编码之路 299

【Leetcode】Valid Palindrome

题目链接:https://leetcode.com/problems/valid-palindrome/ 题目: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example, "A man,

业精于勤,荒于嬉 1700
上一篇: LeetCode : atoi My solution
下一篇: LeetCode Add Binary |My Solution
AresGod
博客等级 码龄24年 37粉丝 89原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值