C++ Programs - Hard Articles
Given an array of N numbers and an integer K. The task is to print the number of unique subsequences possible of length K.  Examples:… Read More
Given a grid with different colors in a different cell, each color represented by a different number. The task is to find out the largest… Read More
The Strassen’s method of matrix multiplication is a typical divide and conquer algorithm. We have discussed Strassen’s Algorithm here. However, let’s get again on what’s… Read More
LValue and RValue in C Background Quite a few of you who are about to read this article, might be looking for clarification of what… Read More
Given a 3 x n board, find the number of ways to fill it with 2 x 1 dominoes.Example 1: Following are all the 3… Read More
Given a rectangular matrix M[0…n-1][0…m-1], and queries are asked to find the sum / minimum / maximum on some sub-rectangles M[a…b][e…f], as well as queries… Read More
An ordered tree is an oriented tree in which the children of a node are somehow ordered. It is a rooted tree in which an… Read More
Given an array of n integers, slope of a line i. e., m and the intercept of the line i.e c, Count the number of… Read More
Given a 2-D matrix, find the element having maximum value using multi-threading. Prerequisite : Multithreading Examples : Input : {{1, 5, 3, 6}, {22, 10,… Read More
Fast inverse square root is an algorithm that estimates , the reciprocal (or multiplicative inverse) of the square root of a 32-bit floating-point number x in… Read More
Newspapers and magazines often have crypt-arithmetic puzzles of the form: Examples: Input : s1 = SEND, s2 = "MORE", s3 = "MONEY" Output : One… Read More
Stringstream is stream class present in C++ which is used for doing operations on a string. It can be used for formatting/parsing/converting a string to… Read More
The below implementation is to generate random number from 1 to given limit. The below function produces behavior similar to srand() function. Prerequisite : random… Read More
Given n×m big rectangular area with unit squares and k times cut is allowed, the cut should be straight (horizontal or vertical) and should go… Read More
Topological sorting for Directed Acyclic Graph (DAG) is a linear ordering of vertices such that for every directed edge uv, vertex u comes before v… Read More