add: 只出现一次的数字等
This commit is contained in:
12
src/string/reverse-words-in-a-string.js
Normal file
12
src/string/reverse-words-in-a-string.js
Normal file
@ -0,0 +1,12 @@
|
||||
// LeetCode 557. 反转字符串中的单词 III https://leetcode-cn.com/problems/reverse-words-in-a-string-iii/
|
||||
// LintCode 1173. 反转字符串 III https://www.lintcode.com/problem/reverse-words-in-a-string-iii/description
|
||||
|
||||
export default (s) => {
|
||||
return s.split(' ').map(item => {
|
||||
let tmp = ''
|
||||
for (let n = item.length; n >= 0; n--) {
|
||||
tmp += item.charAt(n)
|
||||
}
|
||||
return tmp
|
||||
}).join(' ')
|
||||
}
|
Reference in New Issue
Block a user