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
Difficulty: 简单
Related Topics: 双指针, 字符串
给定一个字符串 s ,你需要反转字符串中每个单词的字符顺序,同时仍保留空格和单词的初始顺序。
s
示例 1:
输入:s = "Let's take LeetCode contest" 输出:"s'teL ekat edoCteeL tsetnoc"
示例 2:
输入: s = "God Ding" 输出:"doG gniD"
提示:
Language: JavaScript
/** * @param {string} s * @return {string} */ var reverseWords = function(s) { return s.split(' ').map(item => { return item.split('').reverse().join('') }).join(' ') };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
557. 反转字符串中的单词 III
Description
Difficulty: 简单
Related Topics: 双指针, 字符串
给定一个字符串
s
,你需要反转字符串中每个单词的字符顺序,同时仍保留空格和单词的初始顺序。示例 1:
示例 2:
提示:
s
包含可打印的 ASCII 字符。s
不包含任何开头或结尾空格。s
里 至少 有一个词。s
中的所有单词都用一个空格隔开。Solution
Language: JavaScript
The text was updated successfully, but these errors were encountered: