题解 | #左旋转字符串#

左旋转字符串

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

function LeftRotateString(str, n)
{
    // write code here
    if(!str) return "";
    for(let i = 0; i < n; i++){
        str = str.slice(1) + str[0]
    }
    return str;
}
module.exports = {
    LeftRotateString : LeftRotateString
};

全部评论

相关推荐

人生一梦:24年我投暑期实习,它以我不是女的为理由拒绝了我查看图片
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务