LeetCode || Rotate Array
来源:互联网 发布:java框架怎么用 编辑:程序博客网 时间:2024/06/05 07:38
class Solution {public: void rotate(vector<int>& nums, int k) { k = k % nums.size(); vector<int> tmp; int n = nums.size(); for(int i = n-1;i>=n-k && i >=0;i--) tmp.push_back(nums[i]); //move to the back for(int i = n-k-1;i>=0;i--) nums[i+k] = nums[i]; for(int i = 0;i<k;i++) nums[i] = tmp[k-i-1]; }};
0 0
- [leetcode][array] Rotate Array
- LeetCode[Array]: Rotate Image
- LeetCode:Rotate Array
- [LeetCode] Rotate Array
- *LeetCode-Rotate Array
- [LeetCode]189.Rotate Array
- Rotate Array - LeetCode - Java
- Rotate Array--Leetcode(Java)
- Leetcode--Rotate Array
- LeetCode: Rotate Array
- LeetCode Rotate Array
- Rotate Array(leetcode)
- leetcode Rotate Array
- Leetcode: Rotate Array
- [Leetcode]11 Rotate Array
- [LeetCode][189][Rotate Array]
- Leetcode:Rotate Array
- LeetCode: Rotate Array
- 兔子--html,js,php,ASP,ASP.NET,JSP的关系
- 1: 错误: 非法字符: \65279
- vs2008 C++项目连接mysql数据库详解
- “Core Data could not fulfill a fault” for objects that were not deleted
- android sdk更新hosts修改
- LeetCode || Rotate Array
- adb shell 命令详解
- [学习笔记—算法] 打印1~10整数的阶乘表
- 各大搜索引擎自动提示API
- 1.安装MySQL
- Zend_Form Decorators使用实例
- 提高代码性能效率总结(一)--Java
- 单片机基础学习—延时程序
- iOS工程师技能列表