We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
判断给定的字符串是否是回文
例如:
字符串 "上海自来水来自海上" 是回文 字符串 "abba" 是回文 字符串 "abca" 不是回文
let isBackStr = str => { let len = str.length let isTargetStr = true for(let i = 0; i < len; i++) { if(str[i] !== str[len - i - 1]) { isTargetStr = false } } return isTargetStr }
执行结果:
isBackStr('上海自来水来自海上') // 调用 // 输出 true isBackStr('abba') // 调用 // 输出 true isBackStr('abca') // 调用 // 输出 false
The text was updated successfully, but these errors were encountered:
No branches or pull requests
题目
判断给定的字符串是否是回文
例如:
字符串 "上海自来水来自海上" 是回文
字符串 "abba" 是回文
字符串 "abca" 不是回文
解析
答案
执行结果:
The text was updated successfully, but these errors were encountered: