Skip to content

Commit d360c4b

Browse files
committed
Add the solution to the 0189_Rotate_Array.py file
1 parent 938e52b commit d360c4b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

LeetCode/0189_Rotate_Array.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class Solution:
2+
def rotate(self, nums: List[int], k: int) -> None:
3+
for i in range(k):
4+
lastValue = nums.pop()
5+
nums.insert(0, lastValue)
6+
return nums

0 commit comments

Comments
 (0)