The longest Increasing Subsequence (LIS) problem is to find the length of the longest subsequence of a given sequence such that all elements of the subsequence are so...

Share

Consider the below problems statement.
There are 100 different types of caps each having a unique id from 1 to 100. Also, there are ‘n’ persons each hav...

Share

Consider a 2-D map with a horizontal river passing through its center. There are n cities on the southern bank with x-coordinates a(1) … a(n) and n cities on t...

Share

Dynamic Programming(DP) is a technique to solve problems by breaking them down into overlapping sub-problems which follows the optimal substructure. There are various...

Share

Given a tree with N nodes and N-1 edges, find out the maximum height of tree when any node in the tree is considered as the root of the tree.
The above diagram repr...

Share

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 that visits ev...

Share

Given three numbers n, r and p, compute value of nCr mod p.
Example:
Input: n = 10, r = 2, p = 13
Output: 6
Explanation: 10C2 is 45 and 45 % 13 is 6.
We strongly ...

Share

Ever wondered how sort() function we use in C++/Java or sorted() in Python work internally?
Here is a list of all the inbuilt sorting algorithms of different programm...

Share

Given a text and a wildcard pattern, find if wildcard pattern is matched with text. The matching should cover the entire text (not partial text).
The wildcard patter...

Share

Sum Rule – If a task can be done in one of ways or one of ways, where none of the set of ways is the same as any of the set of ways, then there are ways ...

Share