0% found this document useful (0 votes)
46 views11 pages

Most Unique DSA Sheet by Shivam Chaudhary

Uploaded by

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

Most Unique DSA Sheet by Shivam Chaudhary

Uploaded by

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

Message from Shivam Chaudhary

Welcome to my curated DSA sheet! I’ve organized the DSA questions into distinct patterns
to help you identify recurring themes and problem-solving techniques. By mastering these
patterns, you'll not only solve problems more efficiently but also gain the confidence to tackle
any DSA Online Assessment (OA) or interview with ease.

Trust me—this approach will change the way you approach DSA questions, giving you a
strategic advantage in cracking even the toughest problems.

Check out my YouTube channel for more insights and tutorials:


youtube.com/@shivamlucknowi

LinkedIn: linkedin.com/in/shivam-chaudhary-05ab3b227
Pattern Number Pattern Name Pattern Number Pattern Name

Pattern 1 Sliding Window Pattern 11 Modified Binary


Search

Pattern 2 Two Pointer Pattern 12 Bitwise XOR

Pattern 3 Fast & Slow Pattern 13 Top 'K' Elements


Pointers

Pattern 4 Merge Intervals Pattern 14 K-way Merge

Pattern 5 Cyclic Sort Pattern 15 Topological Sort


(Graph)

Pattern 6 In-place Reversal of Pattern 16 0/1 Knapsack


a LinkedList (Dynamic
Programming)

Pattern 7 Tree Breadth-First Pattern 17 Unbounded


Search Knapsack

Pattern 8 Depth First Search Pattern 18


(DFS) Fibonacci Numbers

Pattern 9 Two Heaps Pattern 19 Palindromic


Subsequence

Pattern 10 Subsets Pattern 20 Longest Common


Substring

Pattern 1: Sliding Window

● 1. Find Averages of Sub Arrays:


Maximum Average Subarray I (Easy)
● 2. Maximum Sum Subarray of Size K:
Largest Subarray Length K (Easy)
● 3. Smallest Subarray with a Given Sum:
Minimum Size Subarray Sum (Easy)
● 4. Longest Substring with K Distinct Characters:
Longest Substring with at Most K Distinct Characters (Medium)
● 5. Fruits into Baskets:
Fruit into Baskets (Medium)
● 6. Longest Substring with At Most 2 Distinct Characters:
Longest Substring with at Most Two Distinct Characters (Medium)
● 7. No-repeat Substring:
Longest Substring Without Repeating Characters (Hard)
● 8. Longest Substring with Same Letters after Replacement:
Longest Repeating Character Replacement (Hard)
● 9. Longest Subarray with Ones after Replacement:
Max Consecutive Ones III (Hard)
● 10. Permutation in a String:
Permutation in String (Hard)
● 11. String Anagrams:
Find All Anagrams in a String (Hard)
● 12. Smallest Window Containing Substring:
Minimum Window Substring (Hard)
● 13. Words Concatenation:
Substring with Concatenation of All Words (Hard)

Pattern 2: Two Pointer

● 1. Pair with Target Sum aka "Two Sum" (Easy):


Two Sum
● 2. Remove Duplicates (Easy):
Remove Duplicates from Sorted Array
● 3. Remove Element (easy):
Remove Element
● 4. Squaring a Sorted Array (Easy):
Squares of a Sorted Array
● 5. Triplet Sum to Zero (Medium):
3Sum
● 6. Triplet Sum Close to Target (Medium):
3Sum Closest
● 7. Triplets with Smaller Sum (Medium):
3Sum Smaller
● 8. Subarrays with Product Less than a Target (Medium):
Subarray Product Less Than K
● 9. Dutch National Flag Problem (Medium):
Sort Colors
● 10. Quadruple Sum to Target (Medium):
4Sum
● 11. Comparing Strings Containing Backspaces (Medium):
Backspace String Compare
● 12. Minimum Window Sort (Medium):
Shortest Subarray to be Removed to Make Array Sorted

Pattern 3: Fast & Slow Pointers

● 1. LinkedList Cycle (Easy):


LinkedList Cycle
● 2. Start of LinkedList Cycle (Medium):
LinkedList Cycle II
● 3. Happy Number (Medium):
Happy Number
● 4. Middle of the LinkedList (Easy):
Middle of the LinkedList
● 5. Palindrome LinkedList (Medium):
Palindrome LinkedList
● 6. Rearrange a LinkedList (Medium):
Reorder List
● 7. Cycle in a Circular Array (Hard):
Circular Array Loop

Pattern 4: Merge Intervals

● 1. Merge Intervals (Medium):


Merge Intervals
● 2. Insert Interval (Medium):
Insert Interval
● 3. Intervals Intersection (Medium):
Interval List Intersections
● 4. Conflicting Appointments (Medium):
Meeting Rooms
● 5. Minimum Meeting Rooms (Hard):
Meeting Rooms II
● 6. Maximum CPU Load (Hard):
Car Pooling
● 7. Employee Free Time (Hard):
Employee Free Time

Pattern 5: Cyclic Sort

● 1. Cyclic Sort (Easy):


Cyclic Sort (Important Pattern)
● 2. Find the Missing Number (Easy):
Missing Number
● 3. Find All Missing Numbers (Easy):
Find All Numbers Disappeared in an Array
● 4. Find the Duplicate Number (Easy):
Find the Duplicate Number
● 5. Find All Duplicate Numbers (Easy):
Find All Duplicates in an Array
● 6. Find the Smallest Missing Positive Number (Medium):
First Missing Positive
● 7. Find the First K Missing Positive Numbers (Hard):
Kth Missing Positive Number
Pattern 6: In-place Reversal of a LinkedList

● 1. Reverse a LinkedList (Easy):


Reverse Linked List
● 2. Reverse a Sub-list (Medium):
Reverse Linked List II
● 3. Reverse Every K-element Sub-list (Medium):
Reverse Nodes in K-Group
● 4. Reverse Alternating K-element Sub-list (Medium):
Tweak: Reverse Alternate K Nodes
● 5. Rotate a LinkedList (Medium):
Rotate List

Pattern 7: Tree Breadth-First Search

● 1. Binary Tree Level Order Traversal (Easy):


Binary Tree Level Order Traversal
● 2. Reverse Level Order Traversal (Easy):
Binary Tree Level Order Traversal II
● 3. Zigzag Traversal (Medium):
Binary Tree Zigzag Level Order Traversal
● 4. Level Averages in a Binary Tree (Easy):
Average of Levels in Binary Tree
● 5. Level Maximum in a Binary Tree:
Maximum Level Sum of a Binary Tree
● 6. Minimum Depth of a Binary Tree (Easy):
Minimum Depth of Binary Tree
● 7. Maximum Depth of a Binary Tree:
Maximum Depth of Binary Tree
● 8. Level Order Successor (Easy):
Level Order Successor of a Node in Binary Tree
● 9. Connect Level Order Siblings (Medium):
Populating Next Right Pointers in Each Node
● 10. Connect All Level Order Siblings (Medium):
Connect All Siblings of a Binary Tree
● 11. Right View of a Binary Tree (Easy):
Binary Tree Right Side View

Pattern 8: Depth First Search (DFS)

● 1. Binary Tree Path Sum (Easy):


Path Sum
● 2. All Paths for a Sum (Medium):
Path Sum II
● 3. Given a Binary Tree, Return All Root-to-Leaf Paths:
Binary Tree Paths
● 4. Given a Binary Tree, Find the Root-to-Leaf Path with the Maximum Sum:
Sum Root to Leaf Numbers
● 5. Path With Given Sequence (Medium):
Check Root-to-Leaf Path Given Sequence
● 6. Count Paths for a Sum (Medium):
Path Sum III
● 7. Tree Diameter (Medium):
Diameter of Binary Tree
● 8. Path with Maximum Sum (Hard):
Binary Tree Maximum Path Sum

Pattern 9: Two Heaps

● 1. Find the Median of a Number Stream (Medium):


Find Median from Data Stream
● 2. Sliding Window Median (Hard):
Sliding Window Median
● 3. Maximize Capital (Hard):
IPO
● 4. Next Interval (Hard):
Find Right Interval

Pattern 10: Subsets

● 1. Subsets (Easy):
Subsets
● 2. Subsets With Duplicates (Medium):
Subsets II
● 3. Permutations (Medium):
Permutations
● 4. String Permutations by Changing Case (Medium):
Letter Case Permutation
● 5. Balanced Parentheses (Hard):
Generate Parentheses
● 6. Unique Generalized Abbreviations (Hard):
Generalized Abbreviation
● 7. Evaluate Expression (Hard):
Different Ways to Add Parentheses
● 8. Structurally Unique Binary Search Trees (Hard):
Unique Binary Search Trees II
● 9. Count of Structurally Unique Binary Search Trees (Hard):
Unique Binary Search Trees
Pattern 11: Modified Binary Search

● 1. Order-agnostic Binary Search (Easy):


Binary Search
● 2. Ceiling of a Number (Medium):
Ceiling in a Sorted Array
● 3. Search Insert Position (Medium):
Search Insert Position
● 4. Next Letter (Medium):
Find Smallest Letter Greater Than Target
● 5. Number Range (Medium):
Find First and Last Position of Element in Sorted Array
● 6. Search in a Sorted Infinite Array (Medium):
Search in a Sorted Array of Unknown Size
● 7. Minimum Difference Element (Medium):
Minimum Absolute Difference
● 8. Bitonic Array Maximum (Easy):
Maximum Value in a Bitonic Array
● 9. Search Bitonic Array (Medium):
Find Element in Bitonic Array
● 10. Search in Rotated Array (Medium):
Search in Rotated Sorted Array
● 11. Search in Rotated Sorted Array II (Medium):
Search in Rotated Sorted Array II
● 12. Rotation Count (Medium):
Find Minimum in Rotated Sorted Array
● 13. Find Minimum in Rotated Sorted Array II (Medium):
Find Minimum in Rotated Sorted Array II

Pattern 12: Bitwise XOR

● 1. Missing in Array (Easy):


Missing Number in Array
● 2. Single Number (Easy):
Single Number
● 3. Two Single Numbers (Medium):
Single Number III
● 4. Complement of Base 10 Number (Medium):
Complement of Base 10 Integer
● 5. Flip Binary Matrix (Hard):
Flipping an Image
Pattern 13: Top 'K' Elements

● 1. Kth Largest Element in an Array (Medium):


Kth Largest Element in an Array
● 2. Kth Smallest (Medium):
Kth Smallest Element
● 3. 'K' Closest Points to the Origin (Easy):
K Closest Points to Origin
● 4. Connect Ropes (Easy):
Minimum Cost to Connect Sticks
● 5. Top 'K' Frequent Numbers (Medium):
Top K Frequent Elements
● 6. Frequency Sort (Medium):
Sort Characters by Frequency
● 7. Kth Largest Number in a Stream (Medium):
Kth Largest Element in a Stream
● 8. 'K' Closest Numbers (Medium):
Find K Closest Elements
● 9. Maximum Distinct Elements (Medium):
Least Number of Unique Integers After K Removals
● 10. Sum of Elements (Medium):
Sum of Elements Between K1th and K2th Smallest Elements
● 11. Rearrange String (Hard):
Reorganize String
● 12. Rearrange String K Distance Apart (Hard):
Rearrange String K Distance Apart
● 13. Scheduling Tasks (Hard):
Task Scheduler
● 14. Frequency Stack (Hard):
Maximum Frequency Stack

Pattern 14: K-way Merge

● 1. Merge K Sorted Lists (Medium):


Merge K Sorted Lists
● 2. Kth Smallest Number in M Sorted Lists (Medium):
Kth Smallest Number in M Sorted Lists
● 3. Median of Two Sorted Arrays (Hard):
Median of Two Sorted Arrays
● 4. Merge K Sorted Arrays (Medium):
Merge K Sorted Arrays
● 5. Kth Smallest Number in a Sorted Matrix (Hard):
Kth Smallest Element in a Sorted Matrix
● 6. Smallest Number Range (Hard):
Smallest Range Covering Elements from K Lists
● 7. K Pairs with Largest Sums (Hard):
Find K Pairs with Smallest Sums
● 8. Kth Smallest Number (Hard):
Find K Pairs with Smallest Sums

Pattern 15: Topological Sort (Graph)

● 1. Topological Sort (Medium):


Topological Sort
● 2. Tasks Scheduling (Medium):
Course Schedule
● 3. Tasks Scheduling Order (Medium):
Course Schedule II
● 4. All Tasks Scheduling Orders (Medium):
Task Scheduler
● 5. Alien Dictionary (Hard):
Alien Dictionary
● 6. Reconstructing a Sequence (Hard):
Sequence Reconstruction
● 7. Minimum Height Trees (Hard):
Minimum Height Trees

Pattern 16: 0/1 Knapsack (Dynamic Programming)

● 1. 0/1 Knapsack (Medium):


Maximum Earnings from Taxi
● 2. Equal Subset Sum Partition (Medium):
Partition Equal Subset Sum
● 3. Subset Sum (Medium):
Subset Sum Problem
● 4. Minimum Subset Sum Difference (Hard):
Partition Array into Two Arrays to Minimize Sum Difference
● 5. Count of Subset Sum (Hard):
Combination Sum
● 6. Target Sum (Hard):
Target Sum
Pattern 17: Unbounded Knapsack

● 1. Unbounded Knapsack:
Knapsack with Duplicate Items
● 2. Rod Cutting:
Minimum Cost to Cut a Stick
● 3. Coin Change:
Coin Change
● 4. Minimum Coin Change:
Coin Change 2
● 5. Maximum Ribbon Cut:
Cutting Ribbons

Pattern 18: Fibonacci Numbers

● 1. Fibonacci numbers:
Fibonacci Number
● 2. Staircase:
Climbing Stairs
● 3. Number Factors:
Count of Different Ways to Express N as Sum of 1, 3, 4
● 4. Minimum Jumps to Reach the End:
Jump Game II
● 5. Minimum Jumps with Fee:
Min Cost Climbing Stairs
● 6. House Thief:
House Robber

Pattern 19: Palindromic Subsequence

● 1. Longest Palindromic Subsequence:


Longest Palindromic Subsequence
● 2. Longest Palindromic Substring:
Longest Palindromic Substring
● 3. Count of Palindromic Substrings:
Palindromic Substrings
● 4. Minimum Deletions in a String to Make it a Palindrome:
Minimum Number of Deletions to Make a String Palindrome
● 5. Minimum Insertions in a String to Make it a Palindrome:
Minimum Insertion Steps to Make a String Palindrome
● 6. Find if a String is K-Palindromic:
Valid Palindrome III
● 7. Palindromic Partitioning:
Palindrome Partitioning II
Pattern 20: Longest Common Substring

● 1. Longest Common Substring:


Longest Common Substring
● 2. Longest Common Subsequence:
Longest Common Subsequence
● 3. Minimum Deletions & Insertions to Transform a String into Another:
Minimum Number of Deletions and Insertions
● 4. Longest Increasing Subsequence:
Longest Increasing Subsequence
● 5. Maximum Sum Increasing Subsequence:
Maximum Sum Increasing Subsequence
● 6. Shortest Common Super-sequence:
Shortest Common Supersequence
● 7. Minimum Deletions to Make a Sequence Sorted:
Minimum Number of Deletions to Make a Sorted Sequence
● 8. Longest Repeating Subsequence:
Longest Repeating Subsequence
● 9. Subsequence Pattern Matching:
Subsequence Pattern Matching
● 10. Longest Bitonic Subsequence:
Longest Bitonic Subsequence
● 11. Longest Alternating Subsequence:
Longest Alternating Subsequence
● 12. Edit Distance:
Edit Distance
● 13. Strings Interleaving:
Strings Interleaving

You might also like