提交 3e99c03d 编写于 作者: yin-zh's avatar yin-zh

更新src/main/java/com/yzh/RotateArray.java

上级 d3fcd02a
package com.yzh; package com.yzh;
/**
* 要求通过前面所学的旋转数组算法:在不占用额外空间的条件下 将所给的数组中的元素向右移动k个位置,使用Java语言实现
* 输入:给定数组 nums
* 移动距离 k
* 输出:移动k个位置后的数组 nums
*/
public class RotateArray { public class RotateArray {
public void solution(int nums[],int k){ public int[] solution(int[] nums,int k){
//请在下方编辑代码,可调用后面的数组翻转函数
//请在下方编辑你的代码,如有需要请另写函数
return nums;
}
/**
* 数组翻转函数:对数组的指定部分进行翻转
* 输入:给定的数组 nums
* 翻转开始位置:start
* 翻转结束位置:end
*/
public void reverse(int[] nums, int start, int end) {
//请在下方编辑 数组翻转函数
}
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册