All Hard Articles
Given an array containing only 0s and 1s, find the largest subarray which contains equal no of 0s and 1s. The expected time complexity is… Read More
Given a positive integer N, the task is to count the total number of set bits in binary representation of all numbers from 1 to… Read More
Given a string str, a partitioning of the string is a palindrome partitioning if every sub-string of the partition is a palindrome, the task is… Read More
Given two Binary Search Trees(BST), print the inorder traversal of merged BSTs.  Examples: Input: First BST        3    /     \ 1    … Read More
Pattern searching is an important problem in computer science. When we do search for a string in a notepad/word file, browser, or database, pattern searching… Read More
Given an array arr[] of size N, the task is to find the length of the Longest Increasing Subsequence (LIS) i.e., the longest possible subsequence… Read More
Given a text txt[0..n-1] and a pattern pat[0..m-1], write a function search(char pat[], char txt[]) that prints all occurrences of pat[] in txt[]. You may… Read More
The following is a description of the instance of this famous puzzle involving N = 2 eggs and a building with K = 36 floors.Suppose… Read More
Largest BST in a Binary Tree | Set 3 Method 3 (Shorter, Smarter and More Efficient)  In this section, a different O(n) solution is discussed.… Read More
Given the dimension of a sequence of matrices in an array arr[], where the dimension of the ith matrix is (arr[i-1] * arr[i]), the task… Read More
Write a C program for a given dimension of a sequence of matrices in an array arr[], where the dimension of the ith matrix is… Read More
Given a Singly Linked List which has data members sorted in ascending order. Construct a Balanced Binary Search Tree which has same data members as… Read More
Write a function to connect all the adjacent nodes at the same level in a binary tree. The structure of the given Binary Tree node… Read More
Ever wondered how can you design a class in C++ which can’t be inherited. Java and C# programming languages have this feature built-in. You can… Read More
In the virtual constructor idiom we have seen the way to construct an object whose type is not determined until runtime. Is it possible to create… Read More
Given that integers are read from a data stream. Find the median of elements read so far in an efficient way.  There are two cases… Read More
Can we make a class constructor virtual in C++ to create polymorphic objects? No. C++ being a statically typed (the purpose of RTTI is different) language, it… Read More
Given a set[] of non-negative integers and a value sum, the task is to print the subset of the given set whose sum is equal… Read More
Write a C/C++ program for a given set[] of non-negative integers and a value sum, the task is to print the subset of the given… Read More
The N Queen is the problem of placing N chess queens on an N×N chessboard so that no two queens attack each other. For example,… Read More