Given a string of size n, write functions to perform the following operations on a string-...
Given an Array of size N and a values K, around which we need to right rotate the array. How to quickly print the right rotated array?Examples :...
Given a matrix, clockwise rotate elements in it....
Given a square matrix, turn it by 90 degrees in anti-clockwise direction without using any extra space.Examples :...
Given a square matrix, turn it by 90 degrees in anti-clockwise direction without using any extra space.Examples :...
An element in a sorted array can be found in O(log n) time via binary search. But suppose we rotate an ascending order sorted array at some pivot unknown to you beforehand. So for instance, 1 2 3 4 5 might become 3 4 5 1 2. Devise a way to find an element in the rotated array in O(log n) time....
Given an array, cyclically rotate the array clockwise by one....
Given a singly linked list, rotate the linked list counter-clockwise by k nodes. Where k is a given positive integer. For example, if the given linked list is 10->20->30->40->50->60 and k is 4, the list should be modified to 50->60->10->20->30->40. Assume that k is smaller than the count of nodes in a linked list....
Given two integers N and K, the task is to rotate the digits of N by K. If K is a positive integer, left rotate its digits. Otherwise, right rotate its digits....
Write a function rotate(arr[], d, n) that rotates arr[] of size n by d elements. Example :...
Given a square matrix, the task is that we turn it by 180 degrees in an anti-clockwise direction without using any extra space....
Given an array arr[] of n integers, find the maximum that maximizes the sum of the value of i*arr[i] where i varies from 0 to n-1....