# Category Archives: Dynamic Programming

Given a directed graph and two vertices ‘u’ and ‘v’ in it, count all possible walks from ‘u’ to ‘v’ with exactly k edges on… Read More
Let 1 represent ‘A’, 2 represents ‘B’, etc. Given a digit sequence, count the number of possible decodings of the given digit sequence.  Examples:  Input:… Read More
Given a positive integer N, count all possible distinct binary strings of length N such that there are no consecutive 1’s. Examples:  Input: N =… Read More
Given a boolean expression with following symbols.  Symbols 'T' ---> true 'F' ---> false And following operators filled between symbols  Operators & ---> boolean AND… Read More
Catalan numbers are a sequence of natural numbers that occurs in many interesting counting problems like following. Count the number of expressions containing n pairs… Read More
Given an unsorted array, trim the array such that twice of minimum is greater than maximum in the trimmed array. Elements should be removed either… Read More
The problem is to count all the possible paths from top left to bottom right of a mXn matrix with the constraints that from each… Read More
Given a positive integer n, generate all possible unique ways to represent n as sum of positive integers.  Examples:  Input: n = 2 Output: 2… Read More
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
Given a rope of length n meters, cut the rope in different parts of integer lengths in a way that maximizes product of lengths of… Read More
20 Objective type questions (Technical: OS, Java, Networking) and 2 programs. Time given was 90 minutes.  1) Longest Remaining Time Scheduling  2) Threads  3) subnetmask… Read More
Given a set of numbers, find the Length of the Longest Arithmetic Progression (LLAP) in it. Examples:  set[] = {1, 7, 10, 15, 27, 29} output… Read More
A car factory has two assembly lines, each with n stations. A station is denoted by Si,j where i is either 1 or 2 and… Read More
Given three strings A, B and C. Write a function that checks whether C is an interleaving of A and B. C is said to… Read More
Given an input string and a dictionary of words, find out if the input string can be segmented into a space-separated sequence of dictionary words.… Read More