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
实现一个字符串反转:输入:www.toutiao.com.cn 输出:cn.com.toutiao.www 可以先暴力解决问题,最终看看是否能否根据以下要求优化。
要求: 1.不使用字符串处理函数 2.空间复杂度尽可能小
The text was updated successfully, but these errors were encountered:
const reverseWord = function(str){ return str.split(".").reverse().join('.') }
const reverseWord = function(str){ var rs = '', word = ''; for(var s of str){ if(s === '.'){ rs += word + s; word = ''; }else{ word += s; } } rs += word; return rs; }
Sorry, something went wrong.
No branches or pull requests
实现一个字符串反转:输入:www.toutiao.com.cn 输出:cn.com.toutiao.www
可以先暴力解决问题,最终看看是否能否根据以下要求优化。
The text was updated successfully, but these errors were encountered: