# Category Archives: C++ Programs

Given a 2D binary matrix of N rows and M columns. The task is to check whether the matrix is horizontal symmetric, vertical symmetric, or… Read More
Two Linked Lists are identical when they have the same data and the arrangement of data is also the same. For example, Linked lists a… Read More
Given an array of n integers where each value represents the number of chocolates in a packet. Each packet can have a variable number of… Read More
Given a linked list, check if the linked list has loop or not. Below diagram shows a linked list with a loop.   The following are… Read More
A permutation also called an “arrangement number” or “order,” is a rearrangement of the elements of an ordered list S into a one-to-one correspondence with… Read More
Given a string str, find the length of the longest substring without repeating characters.  For “ABDEFGABEF”, the longest substring are “BDEFGA” and “DEFGAB”, with length… Read More
Given a doubly linked list, write a function to sort the doubly linked list in increasing order using merge sort.For example, the following doubly linked… Read More
Given two Linked Lists, create union and intersection lists that contain union and intersection of the elements present in the given lists. The order of… Read More
Bit Rotation: A rotation (or circular shift) is an operation similar to shift except that the bits that fall off at one end are put… Read More
Given an array A[] consisting 0s, 1s and 2s. The task is to write a function that sorts the given array. The functions should put… Read More
Given two integer arrays arr1[] and arr2[] sorted in ascending order and an integer k. Find k pairs with smallest sums such that one element… Read More
Given a sorted linked list, delete all nodes that have duplicate numbers (all occurrences), leaving only numbers that appear once in the original list. Examples: Input:… Read More
Given a string of size n, write functions to perform the following operations on a string- Left (Or anticlockwise) rotate the given string by d… Read More
Given a linked list, write a function to reverse every alternate k nodes (where k is an input to the function) in an efficient way.… Read More
In C++ input and output are performed in the form of a sequence of bytes or more commonly known as streams. cerr and clog both… Read More