# Category Archives: C++

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
Given a positive integer n which represents the dimensions of a 4n x 4n matrix with values from 1 to n filled from left to… Read More
Given a linked list, write a function to reverse every k nodes (where k is an input to the function).  Example:  Input: 1->2->3->4->5->6->7->8->NULL, K =… Read More
Given an array arr[] of size n and integer k such that k using namespace std;    // Prints beginning and ending indexes of subarray… Read More
Write code to find lexicographic minimum in a circular array, e.g. for the array BCABDADAB, the lexicographic minimum is ABBCABDAD.Source: Google Written TestMore Examples:  Input:… Read More
Write a function rotate(ar[], d, n) that rotates arr[] of size n by d elements.  Rotation of the above array by 2 will make array… Read More
We have introduced Linked Lists in the previous post. We also created a simple linked list with 3 nodes and discussed linked list traversal.All programs… Read More
Given a singly linked list of characters, write a function that returns true if the given list is a palindrome, else false. Recommended: Please solve… Read More
Given an array of random numbers, Push all the zero’s of a given array to the end of the array. For example, if the given… Read More
Given a sorted array and a value x, the ceiling of x is the smallest element in array greater than or equal to x, and… Read More
Given a linked list of 0s, 1s and 2s, sort it.Examples: Input: 1 -> 1 -> 2 -> 0 -> 2 -> 0 -> 1… Read More
Question: Write a function to find if a given integer x appears more than n/2 times in a sorted array of n integers. Basically, we need… Read More
Given a square matrix of order n*n, find the maximum and minimum from the matrix given.  Examples:  Input : arr[][] = {5, 4, 9, 2,… Read More
Given a binary array sorted in non-increasing order, count the number of 1’s in it.  Examples:  Input: arr[] = {1, 1, 0, 0, 0, 0,… Read More
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