lc 557 js

pimkle發表於2018-11-01
/**
 * @param {string} s
 * @return {string}
 */
var reverseWords = function(s) {
    let words = s.split(' ');
    for(let i = 0; i < words.length; ++i){
        let list = words[i].split('');
        words[i] = list.reverse().join('');
    }
    return words.join(' ');
};
複製程式碼

相關文章