# Category: Expert

## Dynamic Programming – Subset Sum Problem

Objective: Given a set of positive integers, and a value sum S, find out if there exist a subset in array whose sum is equal to given sum S. Example: int[] A = {...

## The Word Break Problem

Objective : Given an string and a dictionary of words, find out if the input string can be broken into a space-separated sequence of one or more dictionary words. Example: dictionary = [“I” ,...

## Backtracking – Knight’s Tour Problem

Objective : A knight’s tour is a sequence of moves of a knight on a chessboard such that the knight visits every square only once. If the knight ends on a square that is...

## Backtracking – Search a Word In a Matrix

Objective : Given a 2D matrix of characters. Check whether the word exist in the matrix or not. If it exists then print its path. All movements are allowed (right, left, up, down and...

## Backtracking – N Queens Problem – Better Solution

Objective : In chess, a queen can move as far as she pleases, horizontally, vertically, or diagonally. A chess board has 8 rows and 8 columns. The standard 8 by 8 Queen’s problem asks...

## Backtracking – N Queens Problem

Objective : In chess, a queen can move as far as she pleases, horizontally, vertically, or diagonally. A chess board has 8 rows and 8 columns. The standard 8 by 8 Queen’s problem asks...

## Breadth-First Search/Traversal in a Graph.

Breadth-First Search ( or TraÂ­verÂ­sal)  in a Graph is quite similar to Binary Tree. Click here to read about BFS in Binary Tree. Example: What is Breadth First Search: Breadth-first search (BFS) is an...

## Backtracking – Rat In A Maze Puzzle

Given a maze, NxN matrix. A rat has to find a path from source to destination. maze[0][0] (left top corner)is the source and maze[N-1][N-1](right bottom corner) is destination. There are few cells which are...

## Backtracking – SUDOKU Solver

Given a sudoku problem or partially filled sudoku, write a program to solve the sudoku. What is Sudoku: Sudoku is a puzzle where a partially completed grid is given and objective is to fill...

## Merge K Sorted Arrays

Objective: Given k sorted array, write an algorithm to merge Them into One sorted array. Example : int[][] A = new int[5][]; A[0] = new int[] { 1, 5, 8, 9 }; A[1] =...

## Populate Next Siblings Pointers in a Given Binary Tree OR Populate Next Right Pointers in Each Node

Objective: – Given a binary tree with three pointers left, right and nextSibling). Write the program to provide the nextsibling pointers. This problem can also be referred as “Populating Next Right Pointers in Each...

## Diameter Of a Binary Tree

Objective: – Given a binary tree, write an algorithm to find the diameter of the tree. What is Diameter Of a Tree: Diameter of tree is defined as A longest path or route between...

## Binary Min – Max Heap

A binary heap is a heap data structure created using a binary tree. binary tree has two rules – Binary Heap has to be complete binary tree at all levels except the last level....

## Colorful Numbers

Objective: Given a number, find out whether its colorful or not. Colorful Number: When in a given number, product of every digit of a sub-sequence are different. That number is called Colorful Number. See...

## Print All the Subsets of a Given Set (Power Set)

Objective: Given a set of numbers, print all the posssible subsets of it including empty set. Power Set: In mathematics, PowerSet of any given set S, PS(S) is set of all subsets of S...