0% found this document useful (0 votes)
58 views57 pages

Recursion Backtracking Trees Graphs DP

Uploaded by

royroboy
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
Download as pptx, pdf, or txt
0% found this document useful (0 votes)
58 views57 pages

Recursion Backtracking Trees Graphs DP

Uploaded by

royroboy
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1/ 57

Recursion

Backtracking
Trees
Graphs
DP
Recursion backtracking
Subsets
https://leetcode.com/problems/subsets
/
Subsets 2
https://leetcode.com/problems/subsets
-ii/
Permutations
https://leetcode.com/problems/permut
ations/
Permutations 2
https://leetcode.com/problems/permut
ations-ii/
Combination sum
https://leetcode.com/problems/combin
ation-sum/
Combination sum 2
https://leetcode.com/problems/combin
ation-sum-ii/
Palindrome
partitioning
https://leetcode.com/problems/palindr
ome-partitioning/
DYNAMIC
PROGRAMMING
Longest increasing
subsequence
Longest Increasing Subsequence

https://leetcode.com/problems/longest
-increasing-subsequence/

https://leetcode.com/problems/largest-
divisible-subset/

https://leetcode.com/problems/russian
-doll-envelopes/

https://leetcode.com/problems/maximu
m-length-of-pair-chain/

https://leetcode.com/problems/number
-of-longest-increasing-subsequence/

https://leetcode.com/problems/delete-
and-earn/

https://leetcode.com/problems/longest
Longest common
subsequence
Longest Common Subsequence

https://leetcode.com/problems/longest
-common-subsequence/

https://leetcode.com/problems/edit-dist
ance/

https://leetcode.com/problems/distinct-
subsequences/

https://leetcode.com/problems/minimu
m-ascii-delete-sum-for-two-strings/
Coin change
Coin Change:

https://leetcode.com/problems/coin-ch
ange/

https://leetcode.com/problems/coin-ch
ange-2/

https://leetcode.com/problems/combin
ation-sum-iv/

https://leetcode.com/problems/perfect-
squares/

https://leetcode.com/problems/minimu
m-cost-for-tickets/
Matrix multiply
Matrix multiplication:

https://leetcode.com/problems/minimu
m-score-triangulation-of-polygon/

https://leetcode.com/problems/minimu
m-cost-tree-from-leaf-values/

https://leetcode.com/problems/burst-b
alloons/
Matrix 2d array
Matrix/2D Array:

https://leetcode.com/problems/matrix-
block-sum/

https://leetcode.com/problems/range-s
um-query-2d-immutable/

https://leetcode.com/problems/dungeo
n-game/

https://leetcode.com/problems/triangle
/

https://leetcode.com/problems/maxima
l-square/

https://leetcode.com/problems/minimu
m-falling-path-sum/
Hash DP
Hash + DP:

https://leetcode.com/problems/target-s
um/

https://leetcode.com/problems/longest
-arithmetic-sequence/

https://leetcode.com/problems/longest
-arithmetic-subsequence-of-given-diffe
rence/

https://leetcode.com/problems/maximu
m-product-of-splitted-binary-tree/
State machine
State machine:

https://leetcode.com/problems/best-ti
me-to-buy-and-sell-stock/

https://leetcode.com/problems/best-ti
me-to-buy-and-sell-stock-ii/

https://leetcode.com/problems/best-ti
me-to-buy-and-sell-stock-iii/

https://leetcode.com/problems/best-ti
me-to-buy-and-sell-stock-iv/

https://leetcode.com/problems/best-ti
me-to-buy-and-sell-stock-with-cooldow
n/

https://leetcode.com/problems/best-ti
me-to-buy-and-sell-stock-with-transact
ion-fee/
Real life
Leetcode articles
https://leetcode.com/discuss/general-d
iscussion/665604/Important-and-Usef
ul-links-from-all-over-the-Leetcode

https://leetcode.com/discuss/general-d
iscussion/458695/dynamic-programmi
ng-patterns
GRAPHS
A-Z
LEETCODE
ARTICLES
https://leetcode.com/discuss/general-d
iscussion/655708/Graph-For-Beginner
s-Problems-or-Pattern-or-Sample-Solu
tions

https://leetcode.com/discuss/study-gui
de/2360573/Become-Master-In-Graph
UNION FIND
Union Find:

Identify if problems talks about finding


groups or components.

https://leetcode.com/problems/friend-c
ircles/

https://leetcode.com/problems/redund
ant-connection/

https://leetcode.com/problems/most-st
ones-removed-with-same-row-or-colu
mn/

https://leetcode.com/problems/number
-of-operations-to-make-network-conne
cted/

https://leetcode.com/problems/satisfia
DFS
Start DFS from nodes at boundary:

https://leetcode.com/problems/surroun
ded-regions/

https://leetcode.com/problems/number
-of-enclaves/
DFS PART 2
DFS from each unvisited node/Island
problems

https://leetcode.com/problems/number
-of-closed-islands/

https://leetcode.com/problems/number
-of-islands/

https://leetcode.com/problems/keys-an
d-rooms/

https://leetcode.com/problems/max-ar
ea-of-island/

https://leetcode.com/problems/flood-fill
/
CYCLE FINDING
Breadth First Search

1. Shortest Path:
https://leetcode.com/problems/
01-matrix/

https://leetcode.com/problems/
as-far-from-land-as-possible/

https://leetcode.com/problems/r
otting-oranges/

https://leetcode.com/problems/s
hortest-path-in-binary-matrix/
GRAPH COLORING
Graph coloring/Bipartition
https://leetcode.com/problems/possibl
e-bipartition/

https://leetcode.com/problems/is-grap
h-bipartite/

Problems asks to check if its possible


to divide the graph nodes into 2
groups
Apply BFS for same. Below is a
sample graph coloring approach.
TOPO SORTING
Topological Sort:
Check if its directed acyclic graph and
we have to arrange the elements in an
order in which we need to select the
most independent node at first.
Number of in-node 0

https://leetcode.com/problems/course-
schedule/

https://leetcode.com/problems/course-
schedule-ii/
TOPO SORTING
PART 2
DFS - Iterative and recursive
solutions
LEETCODE ARTICLES
https://leetcode.com/discuss/general-d
iscussion/655708/Graph-For-Beginner
s-Problems-or-Pattern-or-Sample-Solu
tions

https://leetcode.com/discuss/study-gui
de/2360573/Become-Master-In-Graph
Trees - traversals
DFS iterative
Preorder traversal
DFS recursive
Other traversals
Leetcode articles

https://leetcode.com/discuss/general-discussion/937307/iterative-recursive-dfs-bfs
-tree-traversal-in-pre-post-levelorder-views

https://leetcode.com/discuss/study-guide/1212004/binary-trees-study-guide

You might also like