LeetCode之Rotate Array
来源:互联网 发布:java线程 pdf 编辑:程序博客网 时间:2024/05/28 15:51
class Solution {public: void rotate(vector<int>& nums, int k) { if(nums.empty()) return; k %= nums.size(); rotate(nums, 0, nums.size()-1-k); rotate(nums, nums.size()-k, nums.size()-1); rotate(nums, 0, nums.size()-1); } void rotate(vector<int> &nums, int left, int right){ while(left < right) swap(nums[left++], nums[right--]); }};
0 0
- leetcode 之Rotate Array
- leetcode之rotate array
- LeetCode之Rotate Array
- leetcode之Rotate Array
- Leetcode之Rotate Array
- LeetCode之Rotate Array
- Leetcode之Rotate Array 问题
- [leetcode][array] Rotate Array
- LeetCode之Rotate Array(C++)
- LeetCode 之 Rotate Array — C++ 实现
- 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
- 1097. Deduplication on a Linked List
- Codeforces Round #318(Div. 2)(A,B,C,D)
- JSP页面的五种跳转方法
- 虚拟机安装Centos7
- C++ 插入排序算法
- LeetCode之Rotate Array
- 利用LinkList生成一副扑克牌
- 浅谈Android的Activity运行流程(生命周期)
- 编写一个函数根据人的年龄及逆行排序存储
- LDAP概念
- windows mobile 6.5 百度输入法 如何集成到系统中去
- 图像深度
- Ubuntu搭建LAMP及相关配置
- 自定义控件