Cyclically rotate an array by one | C++ | Arrays | Data Structures and Algoritms | GeeksforGeeks #3

Опубликовано: 10 Май 2025
на канале: Dwink
78
1

Given an array, cyclically rotate an array by one.

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains an integer n denoting the size of the array. Then following line contains 'n' integers forming the array.

Output:
Output the cyclically rotated array by one.

Example:
Input:
2
5
1 2 3 4 5
8
9 8 7 6 4 2 1 3

Output:
5 1 2 3 4
3 9 8 7 6 4 2 1

Do follow me on instagram :
Instagram:   / __dwink_  
And GitHub:
GitHub: https://github.com/dwinkwink123


Let's Learn With Fun ;)