189. Rotate Array
来源:互联网 发布:归并排序算法过程图解 编辑:程序博客网 时间:2024/05/16 05:09
题目:https://leetcode.com/problems/rotate-array/
代码:
public class Solution { public void rotate(int[] nums, int k) { k = k%nums.length; int[] temp = new int[k]; for(int i=nums.length-k;i<nums.length;i++) temp[i-nums.length+k] = nums[i]; for(int i=nums.length-k-1;i>=0;i--) nums[i+k] = nums[i]; for(int i=0;i<k;i++) nums[i] = temp[i]; }}1ms
0 0
- Leetcode - Array - 189. Rotate Array
- 189. Rotate Array leetcode(array)
- LeetCode-Array-189. Rotate Array
- [LeetCode]189.Rotate Array
- [Leetcode] 189.Rotate Array
- LeetCode 189. Rotate Array
- 【LeetCode】189.Rotate Array
- [leetcode] 189.Rotate Array
- 【leetcode】189. Rotate Array
- Leetcode 189. Rotate Array
- 189. Rotate Array LeetCode
- 189. Rotate Array
- [LeetCode]189. Rotate Array
- 189. Rotate Array
- leetcode-189.-Rotate Array
- 189. Rotate Array
- 189. Rotate Array
- 189. Rotate Array
- Intel Edison开机自动加载Arduino代码
- hdu 5067 Harry And Dig Machine (TSP类,简单)
- 1095. Cars on Campus (30)
- Python 也能干大事 —— 解方程
- git命令cherrypick
- 189. Rotate Array
- 前端工程师的Java路-一些唠叨与经验总结
- uC/OS-III 函数整理
- 142. linkedlist cycle
- latex(2)排版论文《自动化学报》
- 7 款顶级开源 BI(商务智能)软件和报表工具
- caffe 学习系列之finetuning
- java框架之springmvc07(国际化处理)
- Java Web实战03--Spring之HelloWorld