Palindrome check · 回文判断
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · 此页面需较新浏览器(支持 SharedArrayBuffer)。请升级 Chrome、Edge、Firefox 或 Safari 至最新版本。
English
Palindrome check
A palindrome reads the same forwards and backwards. Return true if s does, ignoring case and spaces, so Race car counts. Clean the string first (toLowerCase, remove spaces), then compare characters moving inward from both ends.
中文
回文判断
回文正读和反读相同。如果 s 是回文就返回 true,忽略大小写和空格,所以 Race car 也算。先清理字符串(toLowerCase、去掉空格),再从两端向中间逐个比较字符。
Complete isPalindrome(String s) so it returns true when s reads the same forwards and backwards, ignoring case and spaces. · 完成 isPalindrome(String s),当 s 正读和反读相同时返回 true,忽略大小写和空格。
Click Run to see the output here. · 点击“运行”查看此处输出。