Quantcast
Channel: rotation– GeeksforGeeks
Browsing all 97 articles
Browse latest View live

Minimum rotations required to get the same string

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 » The post Minimum rotations required to get the same...

View Article


Print left rotation of array in O(n) time and O(1) space

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 » The post Print left rotation of array in O(n) time...

View Article


Rotate Linked List block wise

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 » The post Rotate Linked List block wise appeared first on...

View Article

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 » The post Split the array and add the first part to the end...

View Article

Find element at given index after a number of rotations

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 » The post Find element at...

View Article


Count rotations in sorted and rotated linked list

Given a linked list of n nodes which is first sorted, then rotated by k elements. Find the value of k. Recommended: Please try your… Read More » The post Count rotations in sorted and rotated linked...

View Article

Sort a Rotated Sorted Array

You are given a rotated sorted array and your aim is to restore its original sort in place. Expected to use O(1) extra space and… Read More » The post Sort a Rotated Sorted Array appeared first on...

View Article

Minimum move to end operations to make all strings equal

Given n strings that are permutations of each other. We need to make all strings same with an operation that takes front character of any… Read More » The post Minimum move to end operations to make...

View Article


Rotate a Matrix by 180 degree

Given a square matrix the task is that we turn it by 180 degrees in anti-clockwise direction without using any extra space. Examples: Input :… Read More » The post Rotate a Matrix by 180 degree...

View Article


String slicing in Python to rotate 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 » The post String slicing in Python...

View Article

Count rotations divisible by 8

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

View Article

Queries on Left and Right Circular shift on array

Given an array A of N integers. There are three type of type of commands: 1 x : Right Circular Shift the array x times.… Read More » The post Queries on Left and Right Circular shift on array appeared...

View Article

Find a rotation with maximum hamming distance

Given an array of n elements, create a new array which is a rotation of given array and hamming distance between both the arrays is… Read More » The post Find a rotation with maximum hamming distance...

View Article


Reversal algorithm for right rotation of an array

Given an array, right rotate it by k elements. After K=3 rotation Examples: Input: arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9,… Read More » The post Reversal algorithm for right rotation of an array appeared...

View Article

Rotate the matrix right by K times

Given a matrix of size N*M, and a number K. We have to rotate the matrix K times to the right side. Examples: Input :… Read More » The post Rotate the matrix right by K times appeared first on...

View Article


Rotate Doubly linked list by N nodes

Given a doubly linked list, rotate the linked list counter-clockwise by N nodes. Here N is a given positive integer and is smaller than the… Read More » The post Rotate Doubly linked list by N nodes...

View Article

Check if strings are rotations of each other or not | Set 2

Given two strings s1 and s2, check whether s2 is a rotation of s1. Examples: Input : ABACD, CDABA Output : True Input : GEEKS,… Read More » The post Check if strings are rotations of each other or not...

View Article


Amazon Interview Experience

Round: I An Array arr={7, 7, 8, 8, 9, 1, 1, 4, 2, 2} has numbers appearing twice or once. Duplicates appear side by side… Read More » The post Amazon Interview Experience appeared first on GeeksforGeeks.

View Article

Split the array and add the first part to the end | Set 2

Given an array and split it from a specified position, and move the first part of array add to the end. Examples: Input : arr[]… Read More » The post Split the array and add the first part to the end |...

View Article

Elements that occurred only once in the array

Given an array arr that has numbers appearing twice or once. The task is to identify numbers that occurred only once in the array. Note:… Read More » The post Elements that occurred only once in the...

View Article
Browsing all 97 articles
Browse latest View live


Latest Images