Notes

Personal notes on various topics

View on GitHub

Rotate Array

Problem Description

Given an integer array nums, rotate the array to the right by k steps, where k is non-negative.

Examples

Example 1:

Example 2:

Constraints

Follow Up

Code Template

class Solution:
    def rotate(self, nums: List[int], k: int) -> None:
        """
        Do not return anything, modify nums in-place instead.
        """
        # Write your code here
        pass

Solutions

Back to Problems List Back to Categories