Important Problem ST2
Important Problem ST2
1. Fibonacci Sequence
○ Find the nth Fibonacci number using dynamic programming (with memoization or
tabulation).
2. 0/1 Knapsack Problem
○ Given weights and values of items and a knapsack with a weight limit, find the
maximum value you can put in the knapsack.
3. Longest Increasing Subsequence (LIS)
○ Given an array of integers, find the length of the longest strictly increasing
subsequence.
4. Coin Change Problem
○ Given a set of coin denominations and an amount, find the minimum number of
coins required to make the amount.
5. Longest Common Subsequence (LCS)
○ Given two strings, find the length of the longest subsequence common to both
strings.
6. Edit Distance (Levenshtein Distance)
○ Given two strings, find the minimum number of operations (insertions, deletions,
substitutions) required to convert one string into the other.
7. Partition Problem
○ Given a set of integers, determine if it's possible to partition the set into two
subsets with equal sum.
8. Subset Sum Problem
○ Given a set of numbers, find whether there is a subset whose sum is equal to a
given target value.
9. Matrix Chain Multiplication
○ Given a sequence of matrices, find the most efficient way to multiply them
(minimizing the number of scalar multiplications).
10. Rod Cutting Problem
○ Given a rod of length n and a set of prices for different lengths of the rod, find the
maximum profit obtainable by cutting the rod into smaller lengths.
11. House Robber Problem
● Given a list of non-negative integers representing the amount of money in each house,
determine the maximum amount of money you can rob tonight without robbing two
adjacent houses.
12. Minimum Path Sum in a Grid
● Given a 2D grid of non-negative integers, find a path from the top-left corner to the
bottom-right corner, where you can only move down or right, and the sum of the
numbers along the path is minimized.
13. Word Break Problem
● Given a string and a dictionary of words, determine if the string can be segmented into a
space-separated sequence of dictionary words.
14. Maximum Subarray Sum (Kadane's Algorithm)
● Given an integer array, find the contiguous subarray (containing at least one number)
which has the largest sum and return that sum.
15. Unique Paths
● Given a grid with dimensions m x n, find the number of unique paths from the top-left
corner to the bottom-right corner, moving only down or right.
Graph
1. Find the Shortest Path in an Unweighted Graph
○ Problem: Given an unweighted graph (either directed or undirected) and a
source node, find the shortest path to all other nodes using BFS.
2. Connected Components in an Undirected Graph
○ Problem: Given an undirected graph, find all the connected components using
BFS.
3. Level of Each Node in a Graph
○ Problem: Given a graph, find the level (or distance) of each node from a given
source node using BFS.
4. Word Ladder Problem
○ Problem: Given two words (start and end), and a dictionary, find the shortest
transformation sequence from start to end such that each transformed word must
exist in the dictionary. Each transformation can only change one letter at a time.
5. Number of Islands
○ Problem: Given a 2D grid representing a map where '1' represents land and
'0' represents water, find the number of islands. An island is surrounded by
water and is formed by connecting adjacent lands horizontally or vertically.