Skip to content

Category Archives: Backtracking

What is Recursion? The process in which a function calls itself directly or indirectly is called recursion and the corresponding function is called a recursive… Read More
4 – Queens’ problem is to place 4 – queens on a 4 x 4 chessboard in such a manner that no queens attack each… Read More
Given the number of pages in N different books and M students. Every student is assigned to read some books that can be consecutive or… Read More
Given an array A[] of positive integers, print all the unique non-empty subsets of the array  Note: The set can not contain duplicate elements, so… Read More
Given four numbers L, R, K, and X, the task is to find K distinct decimal numbers in the range [L, R] such that their… Read More
Given a Binary search tree having N nodes, the task is to find all the paths starting at the root and ending at any leaf… Read More
Given arr[] of 5 integers denoting the values of X+Y, X−Y, X*Y, X%Y and ⌊X/Y⌋  in sorted order for two non-zero integers X and Y,… Read More
Given an array Arr[] of size N, the task is to find the count of subsets of Arr[] that can be partitioned into two non-empty… Read More
Given an N*M (N + M ≤ 40)matrix mat[][], each cell has some value ranging from 0 to 1018 and an integer  K. Find the… Read More
In the COVID times, a movie theatre has to follow a Social distance rule where every two seated individuals must have at least 6 feet… Read More
Given a string str, consisting of lower case English alphabets and digits(0-9),  the task is to print all possible strings in lexicographic order that can… Read More
Given a string str, the task is to find whether it contains an additive sequence or not. A string contains an additive sequence if its… Read More
Given an integer N, the task is to print the ways to get the sum N by repeatedly throwing a dice. Input: N = 3Output: 1… Read More
Given 2 integers M and N, the task is to find the count of all the possible paths from top left to the bottom right… Read More
Given a root of binary tree and two integers startValue and destValue denoting the starting and ending node respectively. The task is to find the… Read More

Start Your Coding Journey Now!