# Category Archives: Backtracking

Given a list of strings arr[] of zeros and ones only and two integer N and M, where N is the number of 1’s and… Read More
Given two arrays A[] and B[] of N and M integers respectively, the task is to find the maximum length of equal subarray or the… Read More
Given an array of integers and a number K. The task is to find the maximum sum which is divisible by K from the given… Read More
Given an array arr[] of integers and an integer K, the task is to print all subsets of the given array with the sum equal… Read More
Given a binary tree and an integer K, the task is to print the paths from root to leaf with the maximum element greater than… Read More
Given an array of strings arr[], for every string in the array, print all possible combinations of strings that can be concatenated to make that… Read More
Given a string str, the task is to find the length of the longest palindromic subsequence of even length with no two adjacent characters same… Read More
Given an array arr[] of length N, the task is to find the overall sum of subsets of all the subsets of the array. Examples:… Read More
Given an array arr[] of length N, the task is to find the overall sum of subsets of all the subsets of the array. Examples:… Read More
Given an array arr[] of length N, the task is to find the overall sum of subsets of all the subsets of the array. Examples:… Read More
Given a string str, the task is to print all the permutations of str. A permutation is an arrangement of all or part of a… Read More
Given an N * N binary maze where a 0 denotes that the position can be visited and a 1 denotes that the position cannot… Read More
Given a maze of 0 and -1 cells, the task is to find all the paths from (0, 0) to (n-1, m-1), and every path… Read More
Given a 2-D matrix mat[][], the task is to print it in the spiral form. Examples: Input: mat[][] = { {1, 2, 3, 4}, {5,… Read More
Given a string containing only digits, restore it by returning all possible valid IP address combinations. A valid IP address must be in the form… Read More