LeetCode刷题(初级):旋转数组

给定一个整数数组 nums,将数组中的元素向右轮转 k 个位置,其中 k 是非负数。

public static void sort(int[] nums,int k) {
        //想前面的数组复制到临时数组
        int n = nums.length;
        int[] temp = new int[n];
        //复制数组
        for(int i = 0;i

出处:

作者:LeetCode
链接:力扣
来源:力扣(LeetCode)
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

你可能感兴趣的:(算法,leetcode,数学建模,算法)