Faster than 99.56% - JavaScript
```\nvar rotate = function(nums, k) {\n   k %= nums.length // if k is greater than nums.length then one cycle is completed that means it will remain the same an
```\nvar rotate = function(nums, k) {\n   k %= nums.length // if k is greater than nums.length then one cycle is completed that means it will remain the same and we have to remainder shifts\n    \n   let reverse = function(i, j){\n    while(i < j){\n        let temp = nums[i]\n        nums[i] = nums[j]\n        nums[j] = temp\n        i++\n        j--\n    }\n   } // suppose  ----->---> \n\treverse(0, nums.length-1); // reverse   <--<------\n\t reverse(0, k-1) // reverse first part ---><----\n   reverse(k, nums.length-1)// reverse second part --->----->\n    \n};
['JavaScript']