题目描述
Given an array, rotate the array to the right by k steps, where k is non-negative.
Example 1:
1 | Input: [1,2,3,4,5,6,7] and k = 3 |
Example 2:
1 | Input: [-1,-100,3,99] and k = 2 |
利用另一个数组对结果进行存储。
代码实现
1 | class Solution: |
题目描述
Given an array, rotate the array to the right by k steps, where k is non-negative.
Example 1:
1 | Input: [1,2,3,4,5,6,7] and k = 3 |
Example 2:
1 | Input: [-1,-100,3,99] and k = 2 |
利用另一个数组对结果进行存储。
代码实现
1 | class Solution: |