My perfect Java code O(1) 1ms use reverse
public class Solution {\n        public void reverse(int[] nums, int l, int r) {\n    \t\twhile (l < r) {\n    \t\t\tint temp = nums[l];\n    \t\t\tnums[l++] = 
    public class Solution {\n        public void reverse(int[] nums, int l, int r) {\n    \t\twhile (l < r) {\n    \t\t\tint temp = nums[l];\n    \t\t\tnums[l++] = nums[--r];\n    \t\t\tnums[r] = temp;\n    \t\t}\n    \t}\n    \n    \tpublic void rotate(int[] nums, int k) {\n    \t\tint n = nums.length;\n    \t\tk = (n == 0 ? 0 : k % n);\n    \t\treverse(nums, 0    , n - k);\n    \t\treverse(nums, n - k, n    );\n    \t\treverse(nums, 0    , n    );\n    \t}\n    }
['Java']