Skip to content

Category Archives: C++

Given an array, a positive integer, sort the array in ascending order such that the element at index K in the unsorted array stays unmoved… Read More
Given N numbers with no duplicates, count the number of unique triplets (ai, aj, ak) such that their XOR is 0. A triplet is said… Read More
Given an integer x, the task is to find if every k-cycle shift on the element produces a number greater than or equal to the… Read More
Given a string S of lowercase English alphabets, the task is to find the minimum number of characters to be changed such that the left… Read More
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 : N… Read More
An array contains both positive and negative numbers in random order. Rearrange the array elements so that positive and negative numbers are placed alternatively. Number… Read More
Given an n x n matrix in the given matrix, you have to print the elements of the matrix in the snake pattern. Examples:  Input… Read More
Given an array of n integers. You are given q queries. Write a program to print the floor value of mean in range l to… Read More
Given an array A[] of size N. Solve Q queries. Find the product in the range [L, R] under modulo P ( P is Prime). … Read More
Given two arrays with size n, maximize the first array by using the elements from the second array such that the new array formed contains… Read More
Given a square matrix and the task is to check the matrix is in lower triangular form or not. A square matrix is called lower… Read More
Given a matrix of N*M order. Find the shortest distance from a source cell to a destination cell, traversing through limited cells only. Also you… Read More
Given a square matrix, the task is that we turn it by 180 degrees in an anti-clockwise direction without using any extra space.  Examples : … Read More
Given a String S of length N, two integers B and C, the task is to traverse characters starting from the beginning, swapping a character… Read More