LeetCode : Rotate Array
来源:互联网 发布:常用协议端口号 编辑:程序博客网 时间:2024/06/06 09:24
Rotate an array of n elements to the right by k steps.
For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].
class Solution {public: void rotate(vector<int>& nums, int k) { vector<int> t = nums; for (int i = 0; i < nums.size(); ++i) { nums[(i + k) % nums.size()] = t[i]; } }};
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
- 虚拟机可上外网,可ping通网关,但是ping不通主机,主机却可以ping通虚拟机
- I/O多路复用之 epoll 系统调用
- 学习解析命令行参数函数-getopt函数
- Arduino Mega 2560 Reference Design原理图解读
- 常言
- LeetCode : Rotate Array
- 多维高斯分布模型
- HDU4738【边双连通分量】
- 字符数组
- 抽象类和接口——Java
- 调停者模式(Mediator)
- ehcache
- Unity3d搭建HTTP弱联网的服务器搭建及客户端编写(二)之php服务器
- Unity用Lua开发的 使用度 问题