当前位置:网站首页>018. Valid palindromes
018. Valid palindromes
2022-07-06 09:34:00 【Prism 7】
List of articles
One 、code
1.1 Title Description
1.2 Answer key
class Solution {
public boolean isPalindrome(String s) {
int i = 0;
int j = s.length() - 1;
while(i < j){
char ch1 = s.charAt(i);
char ch2 = s.charAt(j);
if(!Character.isLetterOrDigit(ch1)){
i++;
continue;
}
if(!Character.isLetterOrDigit(ch2)){
j--;
continue;
}
ch1 = Character.toLowerCase(ch1);
ch2 = Character.toLowerCase(ch2);
if(ch1 != ch2){
return false;
}
i++;
j--;
}
return true;
}
}
Two 、 summary
String class :
- s.charAt() Method to return the characters at the specified index . Index range is from 0 To length() - 1.
Character class :
- Character.isLetterOrDigit() // Judge is character or Numbers
- Character.isLowerCase()/Character.isUpperCase() // Determine case
-Character.toLowerCase()/Character.toUpperCase() // Convert case
边栏推荐
- Libuv thread
- Global and Chinese market of appointment reminder software 2022-2028: Research Report on technology, participants, trends, market size and share
- [deep learning] semantic segmentation: paper reading: (CVPR 2022) mpvit (cnn+transformer): multipath visual transformer for dense prediction
- Global and Chinese market of electric pruners 2022-2028: Research Report on technology, participants, trends, market size and share
- Five layer network architecture
- Redis' bitmap
- Opencv+dlib realizes "matching" glasses for Mona Lisa
- [Yu Yue education] Wuhan University of science and technology securities investment reference
- 【深度学习】语义分割:论文阅读:(CVPR 2022) MPViT(CNN+Transformer):用于密集预测的多路径视觉Transformer
- Kratos战神微服务框架(二)
猜你喜欢

五月集训总结——来自阿光

发生OOM了,你知道是什么原因吗,又该怎么解决呢?
![[three storage methods of graph] just use adjacency matrix to go out](/img/79/337ee452d12ad477e6b7cb6b359027.png)
[three storage methods of graph] just use adjacency matrix to go out

Chapter 1 :Application of Artificial intelligence in Drug Design:Opportunity and Challenges

解决小文件处过多

Hard core! One configuration center for 8 classes!

Kratos战神微服务框架(二)

QML control type: Popup

Opencv+dlib realizes "matching" glasses for Mona Lisa

Redis之Lua脚本
随机推荐
为什么要数据分层
Leetcode:608 树节点
Minio distributed file storage cluster for full stack development
Improved deep embedded clustering with local structure preservation (Idec)
How to intercept the string correctly (for example, intercepting the stock in operation by applying the error information)
Lua script of redis
QDialog
Kratos战神微服务框架(一)
Sqlmap installation tutorial and problem explanation under Windows Environment -- "sqlmap installation | CSDN creation punch in"
IDS' deletion policy
Detailed explanation of cookies and sessions
小白带你重游Spark生态圈!
[Yu Yue education] Wuhan University of science and technology securities investment reference
Hard core! One configuration center for 8 classes!
Research and implementation of hospital management inpatient system based on b/s (attached: source code paper SQL file)
Persistence practice of redis (Linux version)
Global and Chinese market of metallized flexible packaging 2022-2028: Research Report on technology, participants, trends, market size and share
Redis之cluster集群
英雄联盟轮播图自动轮播
Redis' bitmap