# Tag Archives: rotation

## Find element at given index after a number of rotationsSeptember 24, 2017

An array consisting of N integers is given. There are several Right Circular Rotations of range[L..R] that we perform. After performing these rotations, we need… Read More »

## Split the array and add the first part to the end

There is a given an array and split it from a specified position, and move the first part of array add to the end. Examples:… Read More »

## Rotate Linked List block wiseSeptember 20, 2017

Given a Linked List of length n and block length k rotate in circular manner towards right/left each block by a number d. If d… Read More »

## Print left rotation of array in O(n) time and O(1) spaceJuly 30, 2017

Given an array of size n and multiple values around which we need to left rotate the array. How to quickly print multiple left rotations?… Read More »

## Minimum rotations required to get the same stringJuly 17, 2017

Given a string, we need to find the minimum number of rotations required to get the same string. Examples: Input : s = “geeks” Output… Read More »

## Quickly find multiple left rotations of an array | Set 1July 4, 2017

Given an array of size n and multiple values around which we need to left rotate the array. How to quickly find multiple left rotations?… Read More »

## Lexicographically smallest rotated sequence | Set 2July 1, 2017

Write code to find lexicographic minimum in a circular array, e.g. for the array BCABDADAB, the lexicographic minimum is ABBCABDAD Input Constraint: 1 < n… Read More »

## Check if two numbers are bit rotations of each other or notJune 11, 2017

Given two positive integers x and y, check if one integer is obtained by rotating bits of other. Input constraint: 0 < x, y <… Read More »

## Left Rotation and Right Rotation of a StringMay 15, 2017

Given a string of size n, write functions to perform following operations on string. Left (Or anticlockwise) rotate the given string by d elements (where… Read More »

## Count rotations divisible by 4March 28, 2017

Given a large positive number as string, count all rotations of the given number which are divisible by 4. Examples: Input: 8 Output: 1 Input:… Read More »

## Check if a string can be obtained by rotating another string 2 placesMarch 16, 2017

Given two strings, the task is to find if a string can be obtained by rotating another string two places. Examples: Input : string1 =… Read More »

## Rotate a matrix by 90 degree without using any extra space | Set 2March 12, 2017

Given a square matrix, turn it by 90 degrees in anti-clockwise direction without using any extra space. Examples: Input 1 2 3 4 5 6… Read More »

## Find the Rotation Count in Rotated Sorted arrayMarch 1, 2017

Consider an array of distinct numbers sorted in increasing order. The array has been rotated (anti-clockwise) k number of times. Given such an array, find… Read More »

## Check if all rows of a matrix are circular rotations of each otherJanuary 14, 2017

Given a matrix of n*n size, the task is to find whether all rows are circular rotations of each other or not. Input: mat[][] =… Read More »

## Rotate each ring of matrix anticlockwise by K elementsNovember 19, 2016

Given a matrix of order M*N and a value K, the task is to rotate each ring of the matrix anticlockwise by K elements. If… Read More »