Tutorials
Courses
Go Premium
Data Structure
Java
Python
HTML
Interview Preparation
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
SQL
Web Development
System Design
Aptitude
GfG Premium
Similar Topics
Web Technologies
32.1K+ articles
DSA
20.0K+ articles
Python
19.6K+ articles
JavaScript
9.9K+ articles
Java
9.3K+ articles
Arrays
4.2K+ articles
C++
3.7K+ articles
Amazon
1.9K+ articles
number-digits
612+ articles
array-rearrange
470+ articles
rotation
415+ posts
Recent Articles
Popular Articles
Rotate a Matrix k Times Clockwise
Last Updated: 23 July 2025
Given a matrix of order m*n and a value k, the task is to rotate each ring of the matrix clockwise by k.Examples:Input :k = 3 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16...
read more
Matrix
DSA
rotation
Rotate Matrix Counterclockwise by 1
Last Updated: 18 October 2024
Given a square matrix, the task is to rotate its elements counterclockwise by one step.Examples:Input 1 2 34 5 6 7 8 9Output: 2 3 61 5 94 ...
read more
Matrix
DSA
rotation
Juggling Algorithm for Array Rotation
Last Updated: 23 July 2025
Given an array arr[], the task is to rotate the array by d positions to the left using juggling algorithm. Examples: Input: arr[] = {1, 2, 3, 4, 5, 6}, d = 2Output: {3, 4,...
read more
DSA
Arrays
rotation
Rotate a 2D Array or Matrix - Complete Tutorial
Last Updated: 23 July 2025
Rotate a Matrix Clockwise by 1Input 1 2 34 5 6 7 8 9Output: 4 1 27 5 3 8 9 6If we take a closer look at this problem, it is mainly a va...
read more
DSA
rotation
Rotate an Array - Clockwise or Right
Last Updated: 23 July 2025
Rotations in the array is defined as the process of rearranging the elements in an array by shifting each element to a new position. This is mostly done by rotating the el...
read more
DSA
rotation
Check if any circular rotation of String has at most X 1s between two adjacent 0s
Last Updated: 14 February 2023
Given a binary string S of length N and an integer X, the task is to check if there exists a right wise circular rotation of the string such that every 2 adjacent 0?s are ...
read more
DSA
rotation
Minimum flips to make Matrix identical for all rotations
Last Updated: 07 October 2022
Given a binary matrix Mat[][] of size N*N, the task is to find the minimum number of flips to be performed such that the matrix is identical for all rotations.Examples:Inp...
read more
Misc
Searching
Matrix
DSA
rotation
Maximum product of first and last character of String after rotation
Last Updated: 05 July 2022
Given a string S of length N, the task is to find the maximum possible product of the first and the last character of the string if it is rotated any number of times towar...
read more
Misc
Strings
DSA
rotation
Left rotate Linked List by X in groups of Y nodes
Last Updated: 23 July 2025
Given a singly linked list and two integers X and Y, the task is to left rotate the linked list by X in groups of Y nodes.Examples:Input: 10 - 20 - 30 - 40 - 50 - 60 - 70 ...
read more
Linked List
Geeks Premier League
Geeks-Premier-League-2022
DSA
rotation
Count of possible rotations of given Array to remove largest element from first half
Last Updated: 28 March 2022
Given an array arr[ ] with even length N, the task is to find the number of cyclic shifts (rotations) possible for this array, such that the first half of array does not c...
read more
Greedy
Geeks Premier League
Geeks-Premier-League-2022
DSA
Arrays
rotation
Print Array after it is right rotated K times where K can be large or negative
Last Updated: 21 September 2022
Given an array arr[] of size N and a value K (-10^5K10^5), the task is to print the array rotated by K times to the right.Examples:Input: arr = {1, 3, 5, 7, 9}, K = 2Outpu...
read more
Misc
DSA
Arrays
rotation
Python3 Program for Longest subsequence of a number having same left and right rotation
Last Updated: 23 July 2025
Given a numeric string S, the task is to find the maximum length of a subsequence having its left rotation equal to its right rotation.Examples:Input: S = "100210601"Outpu...
read more
Python
subsequence
rotation
large-numbers
C++ Program to Find Mth element after K Right Rotations of an Array
Last Updated: 23 July 2025
Given non-negative integers K, M, and an array arr[ ] consisting of N elements, the task is to find the Mth element of the array after K right rotations.Examples:Input: ar...
read more
C++
rotation
array-rearrange
Find Mth element after K Right Rotations of an Array
Last Updated: 23 July 2025
Given non-negative integers K, M, and an array arr[ ] consisting of N elements, the task is to find the Mth element of the array after K right rotations.Examples:Input: ar...
read more
DSA
rotation
array-rearrange
Python3 Program to Find Mth element after K Right Rotations of an Array
Last Updated: 23 July 2025
Python3# Python3 program to implement# the above approach# Function to return Mth element of# array after k right rotationsdef getFirstElement(a, N, K, M): # The array ...
read more
Python
rotation
array-rearrange
1
2
3
4
...
28
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our
Cookie Policy
&
Privacy Policy
Got It !