Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function rotateArray0(arr) {
- let arrLength = arr.length
- let s = Number(arr[arrLength - 1])
- let s1 = s % (arrLength - 1)
- newArr = []
- for (let i = arrLength - s1 - 1, j = 0; i < arrLength - 1; i++, j++)
- newArr[j] = arr[i]
- for (let i = 0; i < arrLength - s1 - 1; i++)
- newArr[i + s1] = arr[i]
- let output = ''
- for (let i = 0; i < newArr.length; i++)
- output += newArr[i] + ' '
- console.log(output)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement