切片轻松搞定
function LeftRotateString(str, n)
{
// write code here
if(!str) return "";
n = n % str.length;
let res = str.slice(n,str.length) + str.slice(0,n);
return res;
}
module.exports = {
LeftRotateString : LeftRotateString
};
切片轻松搞定
function LeftRotateString(str, n)
{
// write code here
if(!str) return "";
n = n % str.length;
let res = str.slice(n,str.length) + str.slice(0,n);
return res;
}
module.exports = {
LeftRotateString : LeftRotateString
};