Category Archives: C++ Programs

Given a square matrix and the task is to check the matrix is in upper triangular form or not. A square matrix is called upper… Read More
Given an array arr[] of size N, the task is to check if it is possible to convert all of the array elements to a… Read More
Given an integer X and two strings S1 and S2, the task is to check that string S1 can be converted to the string S2… Read More
Given a linked list of 0s, 1s and 2s, sort it.Examples: Input: 2->1->2->1->1->2->0->1->0 Output: 0->0->1->1->1->1->2->2->2 The sorted Array is 0, 0, 1, 1, 1, 1,… Read More
Given an array arr[] consisting of N integers, the task is to sort the array in non-increasing order by minimum number of anti-clockwise rotations. If… Read More
Given a permutation arrays A[] consisting of N numbers in range [1, N], the task is to left rotate all the even numbers and right… Read More
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
A matrix is a two-dimensional data object having m rows and n columns, therefore a total of m*n values. If most of the values of… Read More
An array is given of n length, and problem is that we have to find the length of shortest unordered {neither increasing nor decreasing} sub… Read More
Given k linked lists each of size n and each list is sorted in non-decreasing order, merge them into a single sorted (non-decreasing order) linked… Read More
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… Read More
Given an array of integers. Write a program to find the K-th largest sum of contiguous subarray within the array of numbers which has negative… Read More
Given a square matrix of order n*n, you have to interchange the elements of both diagonals. Examples :   Input : matrix[][] = {1, 2, 3, 4,… Read More
Given a square matrix of order n*n, you have to interchange the elements of both diagonals. Examples :   Input : matrix[][] = {1, 2, 3, 4,… Read More
A square matrix is said to be symmetric matrix if the transpose of the matrix is same as the given matrix. Symmetric matrix can be… Read More