Skip to content

Commit c4639ac

Browse files
committed
initial commit
1 parent 8670d0a commit c4639ac

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

LeetCode/rotate-array.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)