## Sum of all sub arrays in O(n) Time

Objec­tive:  Given an array write an algorithm to find the sum of all the possible sub-arrays. Example: int [] a = … 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

## Stock Single Sell Problem – O(n) Solution

Objec­tive:  Given an array represents cost of a stock on each day. You are allowed to buy and sell the stock … Read more

## Maximum Subarray OR Largest Sum Contiguous Subarray Problem – Divide and Conquer

Objec­tive:  The max­i­mum sub­ar­ray prob­lem is the task of find­ing the con­tigu­ous sub­ar­ray within a one-dimensional array of num­bers which has the largest sum. Exam­ple: … Read more

## Dynamic Programming – Count all paths in 2D Matrix with Obstructions in it

Objective: Given two dimensional matrix, write an algorithm to count all possible paths from top left corner to bottom-right corner. You are allowed to move only in two directions, move right OR move down. There are few obstructions as well, means few cells are blocked and you cannot travel that cell.

Many times this problem is being referred as “Robot Travel Problem“. Given a 2d matrix, how many ways a robot can travel from top left corner to bottom right corner and there are few cells in which robot cannot travel.

## Dynamic Programming – 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

## 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

## Single Threaded Binary Tree Complete Implementation

In earlier article “Introduction to Threaded Binary Tree” we have seen what is threaded binary tree, types of it and … Read more

## Generate Maximum revenue by selling K tickets from N windows

Objective: Given ‘N’ windows where each window contains certain number of tickets at each window. Price of a ticket is … Read more