## Sum of subsets of all the subsets of an array | O(2^N)

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 »

## Sum of subsets of all the subsets of an array | O(N)

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 »

## Sum of subsets of all the subsets of an array | O(3^N)

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 »

## Print all the permutations of a string without repetition using Collections in Java

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 »

## Maze With N doors and 1 Key

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 »

## Count number of ways to reach destination in a maze

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 »

## Print a given matrix in spiral form using direction tracking method

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 »

## Program to generate all possible valid IP addresses from given string | Set 2

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 »

## Rat in a Maze Problem when movement in all possible directions is allowed

Consider a rat placed at (0, 0) in a square matrix m[ ][ ] of order n and has to reach the destination at (n-1,… Read More »

## Generate all permutations of a string that follow given constraints

Given a string, generate all permutations of it that do not contain ‘B’ after ‘A’, i.e., the string should not contain “AB” as a substring.… Read More »

## Travelling Salesman Problem implementation using BackTracking

Travelling Salesman Problem (TSP): Given a set of cities and distance between every pair of cities, the problem is to find the shortest possible route… Read More »

## Find triplet such that number of nodes connecting these triplets is maximum

Given a Tree with N nodes, the task is to find a triplet of nodes (a, b, c) such that the number of nodes covered… Read More »

## Print path from root to all nodes in a Complete Binary Tree

Given a number N which is the total number of nodes in a complete binary tree where nodes are number from 1 to N sequentially… Read More »

## Generate all the binary strings of N bits

Given a positive integer number N. The task is to generate all the binary strings of N bits. These binary strings should be in ascending… Read More »

## Java Program to print distinct permutations of a string

Given a string str, the task is to print all the distinct permutations of str. A permutation is an arrangement of all or part of… Read More »