题解 | #左旋转字符串#
左旋转字符串
https://www.nowcoder.com/practice/12d959b108cb42b1ab72cef4d36af5ec
function LeftRotateString(str, n)
{
// write code here
if (!str || str.length === 0) return ''
const array = str.split('')
for (let i = 0; i < n; i++) {
const left = array.shift()
array.push(left)
}
return array.join('')
}
module.exports = {
LeftRotateString : LeftRotateString
};
