## Generate all the strings of length n from 0 to k-1.

Objective: Given two numbers, n and k (k>=n), write an algorithm to generate all the strings of length n drawn … Read more

## Graph – Detect Cycle in a Directed Graph using colors

Objective: Given a directed graph write an algorithm to find out whether graph contains cycle or not. Example: Approach: Graph … Read more

## Graph – Detect Cycle in an Undirected Graph using DFS

Objective: Given undirected graph write an algorithm to find out whether graph contains cycle or not. Example: Approach: Earlier we … Read more

## Graph – Detect Cycle in a Directed Graph

Objective: Given a directed graph write an algorithm to find out whether graph contains cycle or not. Example: Approach: Graph … Read more

## Dynamic Programming – Egg Dropping Problem

Objec­tive:  There are n number of eggs and building which has k floors. Write an algorithm to find the minimum number … Read more

## Nuts & Bolts Problem (Lock & Key problem)

Objec­tive:  Given ‘n’ Nuts and ‘n’ Bolts of different sizes. There is one-to-one mapping between nuts and bolts. Write an algorithm … Read more

## Majority Element- Boyer–Moore majority vote algorithm

Objec­tive:  Given an array of integer write an algorithm to find the majority element in it (if exist). Majority Element: If … Read more

## Find the element which appears maximum number of times in the array.

Objective: Given an array of integers, write a algorithm to find the element which appears maximum number of times in … Read more

## Kadane’s Algorithm – Maximum Subarray Problem

Objective:  The maximum subarray problem is the task of finding the contiguous subarray within a one-dimensional array of numbers which has the largest … Read more

## Dynamic Programming – Coin Change Problem

Objective: Given a set of coins and amount, Write an algorithm to find out how many ways we can make the change of the amount using the coins given.

This is another problem in which i will show you the advantage of Dynamic programming over recursion.

Example:

```Amount = 5

coins [] = {1,2,3}

Ways to make change = 5

{1,1,1,1,1} {1,1,1,2}, {1,2,2}, {1,1,3} {2,3}
```

Approach:

## Dynamic Programming – Subset Sum Problem

Objective: Given a set of positive integers, and a value sum S, find out if there exists a subset in … Read more

## The Word Break Problem

Objective: Given a string and a dictionary of words, find out if the input string can be broken into a … Read more

## Dynamic Programming – Longest Increasing Subsequence

Objective: The longest Increasing Subsequence (LIS) problem is to find the length of the longest subsequence in a given array … Read more

## 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 … Read more

## Backtracking – Search a Word In a Matrix

Objective: Given a 2D matrix of characters. Check whether the word exists in the matrix or not. If it exists … Read more