# Category Archives: C++

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
Given a binary string S of size N, the task is to maximize the sum of the count of consecutive 0s present at the start… Read More
We have one 2D array, filled with zeros and ones. We have to find the starting point and ending point of all rectangles filled with… Read More
Given an array arr[] and an integer k, we need to print k maximum elements of given array. The elements should printed in the order… Read More
Given two strings str1 and str2 and an integer d, the task is to check whether str2 can be obtained by rotating str1 by d… Read More
Given a matrix mat[][] of dimensions M * N, the task is to print the matrix obtained after rotating every ith row of the matrix… Read More
What is a tuple? A tuple in C++ is an object which binds a group of elements together. The elements can be similar as well… Read More