0% found this document useful (0 votes)
175 views24 pages

DSA Pattern Wise Product - Parikh Jain

The document outlines various programming patterns and techniques used in algorithmic problem-solving, particularly in coding interviews. It categorizes problems into types such as Two Pointers, Sliding Window, and Backtracking, providing examples and links to relevant LeetCode problems for each pattern. The document serves as a reference for understanding different approaches to tackle common coding challenges.

Uploaded by

Ansh Bhargava
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
175 views24 pages

DSA Pattern Wise Product - Parikh Jain

The document outlines various programming patterns and techniques used in algorithmic problem-solving, particularly in coding interviews. It categorizes problems into types such as Two Pointers, Sliding Window, and Backtracking, providing examples and links to relevant LeetCode problems for each pattern. The document serves as a reference for understanding different approaches to tackle common coding challenges.

Uploaded by

Ansh Bhargava
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 24

Pattern

Two Pointers Merge Intervals


Type intervals, scheduling, or overlapping
different ends or positions within the
Scenarios descriptions mentioning a
array.
events.
represented
- Look for tasks as pairs
where youof start
need to
Clue sorted array or the need to
and end points, and the task
compare elements from both
Two Sum: https://leetcode.com/problems/two-sum/
Merge Intervals: https://leetcode.com/problems/me
Question 3Sum: https://leetcode.com/problems/3sum/
Insert Interval: https://leetcode.com/problems/inser
s 3Sum Closest: https://leetcode.com/problems/3sum-closest/
Non-overlapping Intervals: https://leetcode.com/pro
Remove Duplicates from Sorted Interval
Array:List
https://leetcode.com/problems/remove-du
Intersections: https://leetcode.com/prob
Squares of a Sorted Array: https://leetcode.com/problems/squares-of-a-sorted-arr
Sorting Sliding Window Prefix Sums
comparing elements elements and slide it across
about subarray sums efficiently.
efficiently. the array.
"window" needs to subarray
array needs to be - Look forsums, cumulative
tasks where sums,
precomputing
- Look for tasks where sorting - Look for tasks where
slide through the you or range sums, and hints that
sorted first or hints that
array, or mention of precomputing sums might
Sort Colors: https://leetcode.com/problems/sort-colors/
Minimum Size SubarrayCount
Sum: https://leetcode.com/problems/minimu
of Smaller Numbers After Self: https://
Meeting Rooms II: https://leetcode.com/problems/meeting-rooms-ii/
Longest Mountain in Array:
Range
https://leetcode.com/problems/longest-m
Sum Query - Mutable: https://leetcode
Largest Number: https://leetcode.com/problems/largest-number/
Longest Continuous Increasing
Count ofSubsequence:
Range Sum: https://leetcode.com/pr
https://leetcode.com/p
Wiggle Sort II: https://leetcode.com/problems/wiggle-sort-ii/
Maximum Points You Can Subarray
Obtain from
Product
Cards:
Lesshttps://leetcode.com/pr
Than K: https://leetcod
Merge Sorted Array: https://leetcode.com/problems/merge-sorted-array/
Maximum Product Subarray:
Find All
https://leetcode.com/problems/maximu
Duplicates in an Array: https://leetco
Pattern
Two Pointers Sliding Window
Type substring within the string with specific
characters within a string
Scenarios string
thator satisfy
to traverse the string
specific
properties (e.g., maximum
sliding window technique.sum,
Clue simultaneously with two pointers. minimum size, longest length) and you
Look for phrases like "substring,"
Phrases like "pair of characters," "contiguous characters," "sliding
Valid Palindrome: https://leetcode.com/problems/valid-palindrome/
Minimum Window Substring: https://leetcode.com/p
Question Reverse Words in a String: https://leetcode.com/problems/reverse-words-in-a-stri
Longest Substring Without Repeating Characters: h
s Longest Palindromic Substring: Longest
https://leetcode.com/problems/longest-palindromi
Substring with At Most K Distinct Character
Implement strStr(): https://leetcode.com/problems/implement-strstr/
Find All Anagrams in a String: https://leetcode.com/
Remove Duplicates from Sorted Longest
Array:Repeating
https://leetcode.com/problems/remove-du
Character Replacement: https://
Hashmaps String Manipulation Regular Expressions
based on some property, or or converting strings into
rules, especially complex
checking for the existence
problem. of different formats. These numbers)
"parse," or specific string patterns or in problem
constraints.
certain characters in the
Problems requiring counting techniques are useful for descriptions.
operations (e.g., reversing,
occurrences, grouping similar Problems requiring
Group Anagrams: https://leetcode.com/problems/group-anagrams/
Reverse String: https://leetcode.com/problems/reverse-string/
Regular Expression Matching: https://leetcod
First Unique Character inReverse
a String:Integer:
https://leetcode.com/problems/first-unique-character-in-a-
https://leetcode.com/problems/reverse-integer/
Regular Expression Matching (with support fo
Valid Anagram: https://leetcode.com/problems/valid-anagram/
String to Integer (atoi): https://leetcode.com/problems/string-to-integ
Wildcard Matching: https://leetcode.com/prob
Longest Palindromic Substring:
Count and
https://leetcode.com/problems/longest-palindromic-substring/
Say: https://leetcode.com/problems/count-and-say/
Decode String: https://leetcode.com/problem
String Compression: https://leetcode.com/problems/string-compression/
Implement strStr(): https://leetcode.com/problems/implement-strstr/
Validate IP Address: https://leetcode.com/pro
Pattern
Basic Binary Search Range Search
Type Involves searching for the maximum or
target element in a sorted
Scenarios array by repeatedly dividing need
minimumto value that satisfies
optimize a value a specific
within
array is sorted, and you need condition within a given range.
Clue to find a specific element
a given range, such as
maximizing or minimizing a
Search Insert Position: https://leetcode.com/problems/search-insert-position/
Split Array Largest Sum: https://leetcode.com/probl
Question Find Minimum in Rotated Sorted Find
Array:
Kth Smallest
https://leetcode.com/problems/find-minim
Element in a Sorted Matrix: https
s Peak Index in a Mountain Array: Capacity
https://leetcode.com/problems/peak-index-in-a-m
To Ship Packages Within D Days: https://le
Find Smallest Letter Greater Than
Maximum
Target:Average
https://leetcode.com/problems/find-sm
Subarray I: https://leetcode.com
Valid Perfect Square: https://leetcode.com/problems/valid-perfect-square/
Allocation Problems Counting Occurences Bitonic Array Search
element in a bitonic array,
items among multiple entities number of occurrences of a
constraints, and the count occurrences or which first increases
exhibits a bitonicand
while optimizing a certain specific value or satisfying a
goal is to optimize a determine the then decreases
behavior, and you(or vice
certain criterion, such frequency of certain need to find an
Allocate Minimum Number Findof First
Pages:andhttps://www.interviewbit.com/problems/allocate-books/
Last Position
FindofPeak
Element
Element:
in Sorted
https://leetcode.com/prob
Array: https://leetco
Minimize Maximum Pair SumCountinNegative
Array: https://leetcode.com/problems/minimize-maximum-pa
Numbers Find
in ainSorted
Mountain
Matrix:
Array:
https://leetcode.com/pr
https://leetcode.com/
Divide Chocolate: https://leetcode.com/problems/divide-chocolate/
Search a 2D Matrix II: https://leetcode.com/problems/search-a-2d-ma
Longest Mountain in Array: https://leetcode.c
Maximum Distance to Gas Find
Station:
Minimumhttps://leetcode.com/problems/minimize-max-distance-to-
in RotatedPeak
Sorted
Index
Array
in aII:
Mountain
https://leetcode.com/proble
Array: https://leetco
Count Primes: https://leetcode.com/problems/count-primes/
Maximum Value at a Given Index in a Bounde
X Problem : Link
Pattern
Basic Recursive Functions Divide & Conquer
Type subproblems of the same type, solve
problem by dividing it into
Scenarios smaller instances of the each subproblem
recursively recursively,
combining and
solutions to
smaller instances of the same combine
Clue smaller instances of the samethe
their solutions to solve
problem, such as factorial
problem, such as binary search or
Factorial: https://leetcode.com/problems/factorial/
Binary Search: https://leetcode.com/problems/binar
Question Fibonacci Number: https://leetcode.com/problems/fibonacci-number/
Merge Sort: https://leetcode.com/problems/sort-an-
s Pow(x, n): https://leetcode.com/problems/powx-n/
Quick Sort: https://leetcode.com/problems/sort-an-a
Greatest Common Divisor of Strings:
Maximumhttps://leetcode.com/problems/greatest-com
Subarray: https://leetcode.com/problems
Minimum Moves to Move a Box to Their Target Location: https://leetcode.com/pro
Backtracking Recursive Search
different choices and
exploring different branches
backtracking when a dead-
combinations, or subsets of a search
searchspace until the
end is reached, undoingof space.
elements while satisfying Tasks requiring finding

Generate Parentheses: https://leetcode.com/problems/generate-parentheses/


Sudoku Solver: https://leetcode.com/problems/sudoku-solver/
Combination Sum: https://leetcode.com/problems/combination-sum/
Number of Islands: https://leetcode.com/problems/number-of-islands
N-Queens: https://leetcode.com/problems/n-queens/
Path Sum: https://leetcode.com/problems/path-sum/
Letter Combinations of aWord
PhoneSearch
Number:
II: https://leetcode.com/problems/word-search-ii/
https://leetcode.com/problems/letter-combinations-
Word Search: https://leetcode.com/problems/word-search/
Pattern
Fast and Slow Pointers Dummy Node Technique
Type elements that meet certain
cases, such as handling an
Scenarios conditions, such as the scenarios where
empty list or dealing with
adding/removing
list efficiently
midpoint of theusing two
linked list,
Clue pointers simultaneously,
the head of the linked list is
cumbersome or requires
Middle of the Linked List: https://leetcode.com/problems/middle-of-the-linked-list/
Add Two Numbers: https://leetcode.com/problems/a
Question Intersection of Two Linked Lists:Merge
https://leetcode.com/problems/intersection-of-tw
Two Sorted Lists: https://leetcode.com/proble
s Linked List Cycle: https://leetcode.com/problems/linked-list-cycle/
Partition List: https://leetcode.com/problems/partitio
Remove Nth Node From End of Remove
List: https://leetcode.com/problems/remove-nth-n
Duplicates from Sorted List: https://leetcod
Odd Even Linked List: https://leetcode.com/problems/odd-even-linked-list/
Linked List Cycle II: https://leetcode.com/problems/linked-list-cycle-ii/
In-Place Reversal
Recursion Technique
require traversal or Technique
without using extra
manipulation of the linked
approach provides in
ana space,list or perform
typically by
linked list structure operations on
elegant solution, such
segments without
Swap Nodes in Pairs: https://leetcode.com/problems/swap-nodes-in-pairs/
Reverse Linked List: https://leetcode.com/problems/reverse-linked-lis
Palindrome Linked List: https://leetcode.com/problems/palindrome-linked-list/
Swap Nodes in Pairs: https://leetcode.com/problems/swap-nodes-in-p
Remove Duplicates fromRotate
SortedList:
List https://leetcode.com/problems/rotate-list/
II: https://leetcode.com/problems/remove-duplicates-from
Flatten a Multilevel Doubly
Reorder
LinkedList:
List:https://leetcode.com/problems/reorder-list/
https://leetcode.com/problems/flatten-a-multilevel-do
Split Linked List in Parts: https://leetcode.com/problems/split-linked-l
Reverse Nodes in k-Group: https://leetcode.com/problems/reverse-no
Pattern
Design Problems Monotonic Stack
Type When you need to design and nearest smaller or greater
Scenarios implement
requirea you
custom
to data structure
design a element
need to the left
to maintain or right in
a monotonic
Clue based on stacks.
stack-based system or an array. For example,
increasing or decreasing finding
stack
implement specific to efficiently track elements'
Implement Queue using Stacks: Next
https://leetcode.com/problems/implement-queue
Greater Element I: https://leetcode.com/proble
Question Implement Stack using Queues: Largest
https://leetcode.com/problems/implement-stack-
Rectangle in Histogram: https://leetcode.co
s Design Browser History: https://leetcode.com/problems/design-browser-history/
Online Stock Span: https://leetcode.com/problems/o
Design Hit Counter: https://leetcode.com/problems/design-hit-counter/
Daily Temperatures: https://leetcode.com/problems
Design Circular Queue: https://leetcode.com/problems/design-circular-queue/
Remove Duplicate Letters: https://leetcode.com/pro
Design Twitter: https://leetcode.com/problems/design-twitter/
Design Snake Game: https://leetcode.com/problems/design-snake-game/
Sliding Window &
Expression Evaluation Two Stacks
arithmetic or logical perform operations Monotonic Queue
element in a window
expression evaluation, efficiently
simulate by utilizing
a specific
involveyou
evaluating efficiently, often used
sliding window or
where need to two stacks, such
behavior or implement as
arithmetic expressions maintain monotonicity
operations efficiently
Basic Calculator II: https://leetcode.com/problems/basic-calculator-ii/
Evaluate Reverse PolishSliding
Notation:
Window
https://leetcode.com/problems/eva
Maximum: https://leetcode.co
Evaluate Division: https://leetcode.com/problems/evaluate-division/
Min Stack: https://leetcode.com/problems/min-stack/
Design Circular Deque: https://leetcode.com/
Simplify Path: https://leetcode.com/problems/simplify-path/
Design a Stack With Increment
Moving Average
Operation:
fromhttps://leetcode.com/prob
Data Stream: https://le
Basic Calculator: https://leetcode.com/problems/basic-calculator/
Baseball Game: https://leetcode.com/problems/baseball-game/
First Unique Number: https://leetcode.com/pr
Decode String: https://leetcode.com/problems/decode-string/
Backspace String Compare: Max https://leetcode.com/problems/backspac
Sum of Rectangle No Larger Than K: http
Pattern
Traversal Construction
Type in the tree exactly once,
such as an array, inorder and
Scenarios exploring
must visitalleach
nodes in a
node preorder/postorder traversal
specific order (e.g., inorder, on provided specifications,
Clue systematically without
reconstructing the tree from its
missing any, often requiring
Binary Tree Inorder Traversal:Construct
https://leetcode.com/problems/binary-tree-inorder-
Binary Tree from Preorder and Inorder Tr
Question Binary Tree Preorder Traversal:
Construct
https://leetcode.com/problems/binary-tree-preord
Binary Tree from Inorder and Postorder T
s Binary Tree Postorder Traversal:
Construct
https://leetcode.com/problems/binary-tree-posto
Binary Tree from Preorder and Postorder
Binary Tree Level Order Traversal:
Daily https://leetcode.com/problems/binary-tree-leve
Temperatures: https://leetcode.com/problems
Binary Tree Zigzag Level OrderRemove
Traversal:
Duplicate
https://leetcode.com/problems/binary-t
Letters: https://leetcode.com/pro
Path Sum & Root to
Mirror & Symmetry Traversal & Search
Leaftree that on a binary tree, such
in a binary
binary tree is
thesum upwhile
tree to a target
keeping as finding the lowest
symmetric
left and or
right subtrees value or enumerate
track of the path and all techniques or search
common ancestor or
recursively or swap the algorithms specific to
its sum, recursively
Invert Binary Tree: https://leetcode.com/problems/invert-binary-tree/
Path Sum: https://leetcode.com/problems/path-sum/
Lowest Common Ancestor of a Binary Tree: h
Symmetric Tree: https://leetcode.com/problems/symmetric-tree/
Path Sum II: https://leetcode.com/problems/path-sum-ii/
Binary Tree Level Order Traversal II: https://le
Flip Equivalent Binary Trees:
Sum https://leetcode.com/problems/flip-equivalent-binary-trees/
Root to Leaf Numbers:Search
https://leetcode.com/problems/sum-root
in a Binary Search Tree: https://leetco
Convert Sorted Array to Binary Search
Tree Maximum
Tree: https://leetcode.com/problems/convert-sorted-ar
Path
Validate
Sum:Binary
https://leetcode.com/problems/bina
Search Tree: https://leetcode
Convert Sorted List to Binary
Path Search
Sum III:Tree:
https://leetcode.com/problems/path-sum-iii/
https://leetcode.com/problems/convert-sorted-list-
Closest Binary Search Tree Value: https://lee
Validation & Properties
properties of a binary
tree, such as
properties ofwhether
binary
it'strees,
a binary search tree
such as BST
validation,
Diameter of Binary Tree: https://leetcode.com/problems/diameter-of-binary-tree/
Count Complete Tree Nodes: https://leetcode.com/problems/count-complete-tree-nodes/
Balanced Binary Tree: https://leetcode.com/problems/balanced-binary-tree/
Binary Tree Longest Consecutive Sequence: https://leetcode.com/problems/binary-tree-longe
Subtree of Another Tree: https://leetcode.com/problems/subtree-of-another-tree/
Top K Frequent Elements
Pattern Finding Kth
Type Largest/Smallest
dataset, and you need You're analyzing data and need
Scenarios where
to efficiently
you need find
to the
track to identify
need tothe most
track frequently
element
Clue Kth largest or smallest occurring elements.
the K largest or smallest frequencies and select the top
elements while K elements based on
Kth Largest Element in anTopArray:
K Frequent
https://leetcode.com/problems/kth-largest-eleme
Elements: https://leetcode.com/problem
Question Kth Smallest Element in aSort
Sorted
Characters
Matrix: https://leetcode.com/problems/kth-smal
By Frequency: https://leetcode.com/prob
s Find Median from Data Stream:
Top K Frequent
https://leetcode.com/problems/find-median-from-
Words: https://leetcode.com/problems/to
K Closest Points to Origin:Top
https://leetcode.com/problems/k-closest-points-to-origi
K Frequent Elements in a Sorted Matrix: https://leetc
Kth Largest Element in a Maximum
Stream: https://leetcode.com/problems/kth-largest-elem
Frequency Stack: https://leetcode.com/proble
Sliding Window
Merge K Lists Design Problems
Maximum/Minimum
maximum or minimum
and need to merge data structure using
where you're required element in all designqueues
a data to
them into a single sliding window of fixed priority
to merge multiple contiguous subarrays structure using
size and efficiently find
sorted sequences while priority queues for
Merge k Sorted Lists: https://leetcode.com/problems/merge-k-sorted-lists/
Sliding Window Maximum: Design
https://leetcode.com/problems/sliding-win
Twitter: https://leetcode.com/problem
Merge Sorted Array: https://leetcode.com/problems/merge-sorted-array/
Maximum Sum of Subarray Design
of Size
Hit Counter:
K: https://leetcode.com/problems
https://leetcode.com/pro
Merge Intervals: https://leetcode.com/problems/merge-intervals/
Minimum Window Substring: Designhttps://leetcode.com/problems/minimum
Browser History: https://leetcode.com
Find Smallest Common Number:
Max Consecutive
https://leetcode.com/problems/find-smallest-common-numb
Ones III:
Design
https://leetcode.com/problems/max-conse
Snake Game: https://leetcode.com/pr
Smallest Range CoveringLongest
Elements Continuous
from K Lists:
Subarray
Design
https://leetcode.com/problems/smallest-rang
With
a Leaderboard:
Absolute Diffhttps://leetcode.com/
Less Than or Equal
Construction and
With Graphs
Manipulation
modify, or
priority queues for
manipulate data nodes or edges
operations like
structures using
structures based on their
based on weights or
Task Scheduler: https://leetcode.com/problems/task-scheduler/
Network Delay Time: https://leetcode.com/problems/network-delay-time/
Rearrange String Cheapest
k DistanceFlights
Apart:Within
https://leetcode.com/problems/rearrange-string-k-distanc
K Stops: https://leetcode.com/problems/cheapest-fli
Reorganize String:
Path
https://leetcode.com/problems/reorganize-string/
with Maximum Probability: https://leetcode.com/problems/path-with-m
Distant Barcodes:The
https://leetcode.com/problems/distant-barcodes/
Maze II: https://leetcode.com/problems/the-maze-ii/
Rearrange WordsKthin aSmallest
Sentence:Element
https://leetcode.com/problems/rearrange-words-in-a-senten
in a Sorted Matrix: https://leetcode.com/problems/kth
Pattern Optimal Substructure
Basic Dynamic Programming
Type
leading to inefficiency. The where an optimal solution can
Scenarios problem
Look for can
recursive problems
be optimized by optimal solution to
be constructed theoptimal
from problem
Clue where subproblems are can be formed by combining
overlapping or repetitive. optimal solutions of its
Fibonacci Number: https://leetcode.com/problems/fibonacci-number/
Maximum Subarray: https://leetcode.com/problems/max
Question Climbing Stairs: https://leetcode.com/problems/climbing-stairs/
Longest Increasing Subsequence: https://leetcode.com/p
s House Robber: https://leetcode.com/problems/house-robber/
Coin Change: https://leetcode.com/problems/coin-chang
Unique Paths: https://leetcode.com/problems/unique-paths/
Edit Distance: https://leetcode.com/problems/edit-distan
Minimum Path Sum: https://leetcode.com/problems/minimum-path-sum/
Longest Common Subsequence: https://leetcode.com/pr
Interval/Range DP Knapsack Problems Prefix Sums
need to find optimal allocation of resources need to efficiently
solutions select items from a set preprocess the array
solution for afor
given to maximize or compute cumulative
to maximize or to compute prefix
interval can be derived
minimize a value sums or counts,
Minimum Falling Path Sum:0/1 https://leetcode.com/problems/minimum-falling-path-sum/
Knapsack: https://leetcode.com/problems/01-knapsack/
Subarray Sum Equals K: https://leetcode.com/pro
Burst Balloons: https://leetcode.com/problems/burst-balloons/
Partition Equal Subset Sum:Range
https://leetcode.com/problems/partition-equal
Sum Query - Immutable: https://leetcode.
Partition Equal Subset Sum: Target
https://leetcode.com/problems/partition-equal-subset-sum/
Sum: https://leetcode.com/problems/target-sum/
Count of Range Sum: https://leetcode.com/proble
Strange Printer: https://leetcode.com/problems/strange-printer/
Minimum Subset Sum Difference:
Number https://leetcode.com/problems/partition-
of Submatrices That Sum to Target: http
Maximum Vacation Days: https://leetcode.com/problems/maximum-vacation-days/
Equal Subset Sum Partition:Subarray
https://leetcode.com/problems/partition-equal
Sums Divisible by K: https://leetcode.co
Counting Probability &
Interval Partitioning
Problems
number of ways Expectations
need to compute the
a set of intervals
to achieve a probability of certain
representing intotheir
by minimum using
the endpoints probability
events or the or
certain distributions
counts, and and use dynamic
expected values
Unique Paths III: https://leetcode.com/problems/unique-paths-iii/
Non-overlapping Intervals:
Knighthttps://leetcode.com/problems/non-overlapping-interva
Probability in Chessboard: https://leetcode.com/proble
Distinct Subsequences:
Partition
https://leetcode.com/problems/distinct-subsequences/
Labels: https://leetcode.com/problems/partition-labels/
Dice Roll Simulation: https://leetcode.com/problems/dice-roll-
Count Different Palindromic
MaximumSubsequences:
Number of Stone
Non-Overlapping
https://leetcode.com/problems/count-different-palindrom
Game VII: https://leetcode.com/problems/stone-game-v
Subarrays With Sum Equals Target: https://
Count Numbers with Split
Unique
ArrayDigits:
into Consecutive
https://leetcode.com/problems/count-numbers-with-unique-digits
Predict Subsequences:
the Winner: https://leetcode.com/problems/predict-the
https://leetcode.com/problems/split-ar
Count of Smaller Numbers
Longest After
Continuous
Self: https://leetcode.com/problems/count-of-smaller-numbers-after-s
Increasing
Cherry Pickup:
Subsequence:
https://leetcode.com/problems/cherry-pickup/
https://leetcode.com/problems/longe
Pattern Finding Connected
Shortest Path Finding
Type you need Components
to identify distinct
edges, you're tasked with
Scenariossubgraphs where
need to group all vertices
nodes based need to optimize
finding distance
the shortest pathor
Clue are connected to each other
on their connectivity, often traversal time between two
involving DFS or BFS points, typically using Dijkstra's
Number of Islands: https://leetcode.com/problems/number-of-islands/
Network Delay Time: https://leetcode.com/problems
Question Connected Components in Undirected
CheapestGraph:
Flightshttps://leetcode.com/problems/num
Within K Stops: https://leetcode.co
s Friend Circles: https://leetcode.com/problems/friend-circles/
Shortest Path in Binary Matrix: https://leetcode.com
Accounts Merge: https://leetcode.com/problems/accounts-merge/
Word Ladder: https://leetcode.com/problems/word-l
Redundant Connection: https://leetcode.com/problems/redundant-connection/
Maze: https://leetcode.com/problems/the-maze/
Minimum Spanning
Cycle Detection Bipartite Graph Check
You're required to it's possible to split the finding theTree minimum
detect
ensurewhether a graph
that no node is vertices into two weight connected
contains cycles or not. color nodes
independent sets such edges and
subtree thatthe need to
connects
visited more than once
alternatively while minimize the total
during traversal,
Course Schedule: https://leetcode.com/problems/course-schedule/
Is Graph Bipartite?: https://leetcode.com/problems/is-graph-bipartite
Minimum Spanning Tree: https://leetcode.com
Find Eventual Safe States:
Possible
https://leetcode.com/problems/find-eventual-safe-states/
Bipartition: https://leetcode.com/problems/possible-bipartiti
Connecting Cities With Minimum Cost: https:
Course Schedule II: https://leetcode.com/problems/course-schedule-ii/
Bipartite: https://leetcode.com/problems/bipartite-graph/
Campus Bikes II: https://leetcode.com/proble
Detect Cycle in Directed Graph
Graph:Coloring:
https://leetcode.com/problems/find-eventual-safe-states/
https://leetcode.com/problems/graph-coloring/
Optimal Division: https://leetcode.com/proble
Redundant Connection II:Matching
https://leetcode.com/problems/redundant-connection-ii/
Bipartite Graph:Redundant
https://leetcode.com/problems/matching-b
Connection II: https://leetcode.co
Directed Acyclic Graph
Graph Coloring
(DAG) Traversal vertices of a graph
graph without cycles,
such
colorthat
the no two
graph
and you
perform need to
a topological adjacent vertices
with a minimum
sort or find the longest
number of colors
Alien Dictionary: https://leetcode.com/problems/alien-dictionary/
Graph Coloring: https://leetcode.com/problems/graph-coloring/
Longest Increasing PathCourse
in a Matrix:
Schedule
https://leetcode.com/problems/longest-increasing-path-in
IV: https://leetcode.com/problems/course-schedule-i
Course Schedule III: https://leetcode.com/problems/course-schedule-iii/
Minimum Number of Vertices to Reach All Nodes: https://leetcode.com
Sequence Reconstruction: Flower
https://leetcode.com/problems/sequence-reconstruction/
Planting With No Adjacent: https://leetcode.com/problems/flow
All Paths from Source Lead to Destination: https://leetcode.com/problems/all-paths-from-sour

You might also like