Skip to content

Category Archives: Dynamic Programming

  Travelling Salesman Problem (TSP):  Given a set of cities and the distance between every pair of cities, the problem is to find the shortest… 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}… Read More
Assembly line scheduling is a manufacturing problem. In automobile industries assembly lines are used to transfer parts from one station to another station. – Manufacturing… 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
Consider a row of N coins of values V1 . . . Vn, where N is even. We play a game against an opponent by… Read More
Given n dice each with m faces, numbered from 1 to m, find the number of ways to get sum X. X is the summation… Read More
Given two strings ‘X’ and ‘Y’, find the length of the longest common substring.  Examples :  Input : X = “GeeksforGeeks”, y = “GeeksQuiz” Output :… Read More
Given string str, the task is to find the minimum number of characters to be inserted to convert it to a palindrome. Before we go… Read More
  You are given a one dimensional array that may contain both positive and negative integers, find the sum of contiguous subarray of numbers which… Read More
Given a 2D array, find the maximum sum submatrix in it. For example, in the following 2D array, the maximum sum submatrix is highlighted with… Read More
Given a Binary Tree, find size of the Largest Independent Set(LIS) in it. A subset of all tree nodes is an independent set if there… Read More
Given a number n, write an efficient function to print all prime factors of n. For example, if the input number is 12, then the… Read More