C++ Programs - Hard Articles
Given an integer N, the task is to generate all possible binary strings of length N which contain “01” as the sub-string exactly twice. Examples: … Read More
Given an array arr[] of N elements and a positive integer K. The task is to find the longest sub-sequence in the array having LCM… Read More
Given an unsorted array arr[] of n integers and an integer k, the task is to find the kth largest element in the given index… Read More
Given a binary tree, the task is to print the maximum sum of nodes of a sub-tree which is also a Binary Search Tree.Examples:  Input… Read More
Given a Binary Tree. The task is to print the circular clockwise spiral order traversal of the given binary tree.Examples:   Input : 1 / \… Read More
Shared Pointers : A std::shared_ptr is a container for raw pointers. It is a reference counting ownership model i.e. it maintains the reference count of its… Read More
Given an array of N numbers, the task is to find the number of sub-arrays (size of the sub-array should be an even number) of… Read More
Given an undirected complete graph of N vertices where N > 2. The task is to find the number of different Hamiltonian cycle of the… Read More
In normal median, we find a point that has minimum sum of distances. Similar concept applies in 2-D space. Given N points in 2-D space, the… Read More
Given side of a square a, the task is to find the side of the largest hexagon that can be inscribed within the given square.Examples:  … Read More
The problem is to print all the possible paths from top left to bottom right of an mXn matrix with the constraints that from each… Read More
Given a string str, the task is to find the sum of the similarities of str with each of its suffixes. The similarity of strings A… Read More
The sin() function for complex numbers is defined in the <complex> header file. This function is the complex version of the sin() function. This function… Read More
Introduction: Digital audio files can contain, in addition to the audio track, related text and/or graphical information. The information you’re probably familiar with takes the… Read More
Given four points (x, y) in the cartesian coordinate. Find the possible no of quadrilaterals than can be formed by joining all the four points. Examples:  … Read More
Given two numbers a and b. The task is to subtract b from a by using 2’s Complement method.Note: Negative numbers represented as 2’s Complement… Read More
Prerequisite: smatch | Regex (Regular Expressions) in C++ Given a regex, the task is to find all regex matches in a string. Without using iterator: … Read More
std::regex_replace() is used to replace all matches in a string, Syntax: regex_replace(subject, regex_object, replace_text) Parameters: It accepts three parameters which are described below: Subject string… Read More
The task is to Add two number using ‘-‘ operator. Examples:  Input : 2 3Output : 5 Input : 10 20Output : 30 The idea… Read More