Open fly0o0 opened 4 years ago
/**
* @param {string} s
* @param {number} n
* @return {string}
*/
var reverseLeftWords = function(s, n) {
let res = ''
for (let i = n; i < s.length; i++) {
res += s.charAt(i)
}
for (let i = 0; i < n; i++) {
res += s.charAt(i)
}
return res
};
/**
* @param {string} s
* @param {number} n
* @return {string}
*/
var reverseLeftWords = function(s, n) {
let res = ''
for (let i = n; i < s.length + n; i++) {
res += s.charAt(i % s.length)
}
return res
};