medium Arrays 100 points

Rotate Array Elements

Write a function that takes an array of integers as input and rotates it clockwise by one position. For example, if the input array is [1, 2, 3, 4, 5], the function should return [5, 1, 2, 3, 4]. The array can be of any size and may contain duplicate elements. You can assume that the input array is not empty. Provide examples of how your function works with different input arrays.

Problem Description

Write a function that takes an array of integers as input and rotates it clockwise by one position. For example, if the input array is [1, 2, 3, 4, 5], the function should return [5, 1, 2, 3, 4]. The array can be of any size and may contain duplicate elements. You can assume that the input array is not empty. Provide examples of how your function works with different input arrays.

Examples

Example

Input: [1, 2, 3, 4, 5]

Output: [5, 1, 2, 3, 4]

Challenge Info

100 Points

Reward

medium

Difficulty

No limit

Time Limit

Submission Stats

Total Submissions 0
Accepted 0
Success Rate 0%