Three simple solutions using C++
void rotate(int nums[], int n, int k) {\n        while(k>0) {\n        int tmp = nums[n-1];\n            for(int i=n-1; i>0; i--) {\n                nums[i] = n
    void rotate(int nums[], int n, int k) {\n        while(k>0) {\n        int tmp = nums[n-1];\n            for(int i=n-1; i>0; i--) {\n                nums[i] = nums[i-1];\n            }\n            nums[0] = tmp;\n            k--;\n        }\n    }\n    \n    void rotate(int nums[], int n, int k) {\n        if (k<=0) {\n            return;\n        }\n        int tmp = nums[n-1];\n        for(int i=n-1; i>0; i--) {\n            nums[i] = nums[i-1];\n        }\n        nums[0] = tmp;\n        rotate(nums, n, k-1);\n    }\n    \n    void strReverse(int nums[], int bgn, int end) {\n        int lst = end-1;\n        while(bgn<lst) {\n            int tmp = nums[bgn];\n            nums[bgn] = nums[lst];\n            nums[lst] = tmp;\n            bgn++;\n            lst--;\n        }\n    }\n    \n    void rotate(int nums[], int n, int k) {\n        if (k<=0) {\n            return;\n        }\n        k = k%n;\n        strReverse(nums, 0, n-k);\n        strReverse(nums, n-k, n);\n        strReverse(nums, 0, n);\n    }
[]