3-line using reverse
void rotate(int nums[], int n, int k) {\n        reverse(nums,nums+n);\n        reverse(nums,nums+k%n);\n        reverse(nums+k%n,nums+n);\n    }
    void rotate(int nums[], int n, int k) {\n        reverse(nums,nums+n);\n        reverse(nums,nums+k%n);\n        reverse(nums+k%n,nums+n);\n    }
[]