Advertisement
kilya

Rotate Array - Python3

Jun 27th, 2020
1,428
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.21 KB | None | 0 0
  1.     def rotate(self, nums: List[int], k: int) -> None:
  2.         for i in range(k):
  3.             previous = nums[-1]
  4.             for j in range(len(nums)):
  5.                 nums[j], previous = previous, nums[j]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement