BackmediumUncategorized uncategorized medium

Circular Array Shift Solution

Problem Statement

Given an array of integers `elements` of size `n` and an integer `shifts`, implement a function to rotate the array by `shifts` positions to the right.

Example 1
Input
{"elements":[12345],"shifts":2}
Output
[4,5,1,2,3]

Explanation: Rotate the array [1,2,3,4,5] 2 steps to the right, resulting in [4,5,1,2,3].

Live Compiler
Loading...
Test Cases & Output
🔒 Sign up to run your code

🚀 Practice this problem

Run code, get AI hints & track streak

Sign Up Free