# Tag Archives: rotation (adsbygoogle = window.adsbygoogle || []).push({});

## Quickly find multiple left rotations of an array | Set 1

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 2

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 not

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 String

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 4

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 places

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 2

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 array

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

## Check if all rows of a matrix are circular rotations of each other

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

## Rotate each ring of matrix anticlockwise by K elements

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 »

## Maximum sum of i*arr[i] among all rotations of a given array

Given an array arr[] of n integers, find the maximum that maximizes sum of value of i*arr[i] where i varies from 0 to n-1. Examples… Read More »

## Inplace rotate square matrix by 90 degrees | Set 1

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

## Find maximum value of Sum( i*arr[i]) with only rotations on given array allowed

Given an array, only rotation operation is allowed on array. We can rotate the array as many times as we want. Return the maximum possbile… Read More »

## Rotate Matrix Elements

Given a matrix, clockwise rotate elements in it. Examples: Input 1 2 3 4 5 6 7 8 9 Output: 4 1 2 7 5… Read More »

## Given a sorted and rotated array, find if there is a pair with a given sum

Given an array that is sorted and then rotated around an unknown point. Find if the array has a pair with a given sum ‘x’.… Read More »