We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8670d0a commit c4639acCopy full SHA for c4639ac
LeetCode/rotate-array.py
@@ -0,0 +1,5 @@
1
+class Solution:
2
+ def rotate(self, nums: List[int], k: int) -> None:
3
+ n = len(nums)
4
+ k = k % n # Normalize k
5
+ nums[:] = nums[-k:] + nums[:-k] # Slice and concatenate
0 commit comments