Before diving into DP, let us first understand where do we use DP.
The core concept of DP is to avoid repeated work by remembering partial results (results of subproblems). This is very critical in terms of boosting performance and speed of algorithm. Most of the problems in computer science and real world can be solved using DP technique.
In real life scenarios, consider the example where I have to go from home to work everyday. For the first time, I can calculate the shortest path between home and work by considering all possible routes. But, it is not feasible to do the calculation every day. Hence, I will be memorizing that shortest path and will be following that route everyday. In computer science terms, Google Maps will be using DP algorithm to find the shortest paths between two points.
Largest Common Subsequence (LCS) problem - Basis of data comparison problems and to identify plagiarism in the contents.
Longest Increasing Subsequence problem - used in DNA Matching between two individuals. Generally, the DNAs are represented as strings and to form a match between DNAs of two individuals, the algorithm needs to find out the longest increasing sub sequence between them. In cases of DNA match, the longest common sub-string (LCS) is also found.
Knapsack Problem You have a bag of limited capacity and you decide to go on a challenging trek. Due to the capacity restriction, you can only carry certain items in optimum quantity. How do you select the materials and its quantity in efficient manner so that you don’t miss out on important items? That’s where DP comes into aid.
Apart from the above, DP has found its importance in various fields like Bioinformatics, Operations research, Decision Making, Image Processing, MATLAB, MS Word, MS Excel, Financial Optimisations, Genetics, XML indexing and querying and what not! Read More.
Problem | Score | Companies | Time | Status |
---|---|---|---|---|
Longest Common Subsequence | 200 |
|
42:05 | |
Longest Palindromic Subsequence | 200 |
|
41:12 | |
Edit Distance | 300 |
|
47:01 | |
Repeating Sub-Sequence | 300 |
|
64:12 | |
Distinct Subsequences | 325 |
|
65:51 | |
Scramble String | 500 |
|
72:54 | |
Regular Expression Match | 500 |
|
79:41 | |
Regular Expression II | 500 |
|
70:40 | |
Interleaving Strings | 500 |
|
62:14 |
Problem | Score | Companies | Time | Status |
---|---|---|---|---|
Length of Longest Subsequence | 200 |
|
65:01 | |
Smallest sequence with given Primes | 200 |
|
67:33 | |
Largest area of rectangle with permutations | 200 |
|
76:53 | |
Tiling With Dominoes | 200 |
|
63:44 | |
Paint House! | 200 |
|
41:35 | |
Ways to Decode | 225 |
|
70:08 | |
Stairs | 225 |
|
15:14 | |
Longest Increasing Subsequence | 300 |
|
30:39 | |
Intersecting Chords in a Circle | 300 |
|
70:18 |
Problem | Score | Companies | Time | Status |
---|---|---|---|---|
Tushar's Birthday Bombs | 200 |
|
80:39 | |
Jump Game Array | 225 |
|
41:16 | |
Min Jumps Array | 300 |
|
71:56 |
Problem | Score | Companies | Time | Status |
---|---|---|---|---|
Longest Arithmetic Progression | 200 |
|
75:50 | |
N digit numbers with digit sum S | 200 |
|
73:15 | |
Shortest common superstring | 200 |
|
58:54 | |
Ways to color a 3xN Board | 200 |
|
65:26 | |
Kth Manhattan Distance Neighbourhood | 200 |
|
64:27 | |
Best Time to Buy and Sell Stock atmost B times | 200 |
|
63:40 | |
Coins in a Line | 300 |
|
63:59 | |
Evaluate Expression To True | 350 |
|
72:21 | |
Egg Drop Problem! | 450 |
|
56:16 | |
Best Time to Buy and Sell Stocks III | 700 |
|
64:45 | |
Longest valid Parentheses | 700 |
|
62:33 |
Problem | Score | Companies | Time | Status |
---|---|---|---|---|
Max edge queries! | 200 |
|
57:34 | |
Max Sum Path in Binary Tree | 400 |
|
55:23 |
Problem | Score | Companies | Time | Status |
---|---|---|---|---|
Kingdom War | 200 |
|
60:45 | |
Maximum Path in Triangle | 200 |
|
33:37 | |
Maximum Size Square Sub-matrix | 200 |
|
44:49 | |
Increasing Path in Matrix | 200 |
|
47:20 | |
Minimum Difference Subsets! | 200 |
|
51:59 | |
Subset Sum Problem! | 200 |
|
45:46 | |
Unique Paths in a Grid | 300 |
|
34:08 | |
Dungeon Princess | 300 |
|
71:49 | |
Min Sum Path in Matrix | 300 |
|
30:33 | |
Min Sum Path in Triangle | 300 |
|
43:26 | |
Max Rectangle in Binary Matrix | 350 |
|
79:19 | |
Rod Cutting | 350 |
|
76:14 | |
Queen Attack | 350 |
|
61:42 | |
Dice Throw | 400 |
|
49:34 |
Problem | Score | Companies | Time | Status |
---|---|---|---|---|
Sub Matrices with sum Zero | 200 |
|
75:37 | |
Coin Sum Infinite | 225 |
|
65:14 | |
Max Product Subarray | 300 |
|
65:25 | |
Best Time to Buy and Sell Stocks I | 300 |
|
28:13 | |
Arrange II | 350 |
|
73:39 |
Problem | Score | Companies | Time | Status |
---|---|---|---|---|
Chain of Pairs | 200 |
|
44:12 | |
Max Sum Without Adjacent Elements | 225 |
|
58:16 | |
Merge elements | 300 |
|
64:11 |
Problem | Score | Companies | Time | Status |
---|---|---|---|---|
Flip Array | 200 |
|
81:31 | |
Tushar's Birthday Party | 200 |
|
72:55 | |
0-1 Knapsack | 200 |
|
49:10 | |
Equal Average Partition | 350 |
|
75:08 |
Problem | Score | Companies | Time | Status |
---|---|---|---|---|
Potions | 200 |
|
52:35 |
Problem | Score | Companies | Time | Status |
---|---|---|---|---|
Best Time to Buy and Sell Stocks II | 225 |
|
40:18 |
Problem | Score | Companies | Time | Status |
---|---|---|---|---|
Word Break II | 350 |
|
68:51 |
Problem | Score | Companies | Time | Status |
---|---|---|---|---|
Unique Binary Search Trees II | 400 |
|
36:29 | |
Count Permutations of BST | 400 |
|
60:04 |
Problem | Score | Companies | Time | Status |
---|---|---|---|---|
Palindrome Partitioning II | 400 |
|
62:58 | |
Word Break | 400 |
|
68:16 |