##
Shortest Common Supersequence
July 4, 2015

Given two strings str1 and str2, find the shortest string that has both str1 and str2 as subsequences.

A computer science portal for geeks

July 4, 2015

Given two strings str1 and str2, find the shortest string that has both str1 and str2 as subsequences.

June 26, 2015

Given a number x, find sum of digits in all numbers from 1 to n. Examples:

April 26, 2015

Given an input number of sections and each section has 2 plots on either sides of the road. Find all possible ways to construct buildings in the plots such that there is a space between any 2 buildings.

April 16, 2015

In a daily share trading, a buyer buys shares in the morning and sells it on same day. If the trader is allowed to make at most 2 transactions in a day, where as second transaction can only start after first one is complete (Sell->buy->sell->buy).

March 6, 2015

This is a famous interview question asked in Google, Paytm and many other company interviews. Below is the problem statement.

March 2, 2015

There are N stations on route of a train. The train goes from station 0 to N-1. The ticket cost for all pair of stations (i, j) is given where j is greater than i. Find the minimum cost to reach the destination.

February 28, 2015

A vertex cover of an undirected graph is a subset of its vertices such that for every edge (u, v) of the graph, either ‘u’ or ‘v’ is in vertex cover.

February 17, 2015

Consider a game where a player can score 3 or 5 or 10 points in a move. Given a total score n, find number of ways to reach the given score.

January 22, 2015

Given N jobs where every job is represented by following three elements of it. 1) Start Time 2) Finish Time. 3) Profit or Value Associated.

December 19, 2014

Given a string ‘str’ of digits, find length of the longest substring of ‘str’, such that the length of the substring is 2k digits and sum of left k digits is equal to the sum of right k digits.

October 2, 2014

A triangulation of a convex polygon is formed by drawing diagonals between non-adjacent vertices (corners) such that the diagonals never intersect.

September 26, 2014

Given the mobile numeric keypad. You can only press buttons that are up, left, right or down to the current button. You are not allowed to press bottom row corner buttons (i.e. * and # ).

August 19, 2014

Given a directed and two vertices ‘u’ and ‘v’ in it, find shortest path from ‘u’ to ‘v’ with exactly k edges on the path.

July 31, 2014

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 the walk.

July 15, 2014

Let 1 represent ‘A’, 2 represents ‘B’, etc. Given a digit sequence, count the number of possible decodings of the given digit sequence.

June 19, 2014

Given a positive integer N, count all possible distinct binary strings of length N such that there are no consecutive 1’s.

May 11, 2014

Catalan numbers are a sequence of natural numbers that occurs in many interesting counting problems like following.

May 3, 2014

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 end of the array.

December 31, 2013

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 cell you can either move only to right or down

November 3, 2013

Travelling Salesman Problem (TSP): Given a set of cities and distance between every pair of cities, the problem is to find the shortest p