题解 | #左旋转字符串#

左旋转字符串

http://www.nowcoder.com/practice/12d959b108cb42b1ab72cef4d36af5ec

function LeftRotateString(str, n)
{
    // write code here
    if(str === null) return "";
    let arr = str.split('');
    while(n) {
        arr.push(arr.shift())
        n--
    }
    return arr.join('')
}
module.exports = {
    LeftRotateString : LeftRotateString
};
全部评论

相关推荐

点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务