0% found this document useful (0 votes)
104 views13 pages

Comprehensive Algorithm Problem List

The document lists different algorithm topics and problems categorized under arrays, dynamic programming, strings, greedy algorithms, depth-first search, breadth-first search, trees, graphs, hash tables, and searching and sorting. It includes over 30 problems under each category.

Uploaded by

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

Comprehensive Algorithm Problem List

The document lists different algorithm topics and problems categorized under arrays, dynamic programming, strings, greedy algorithms, depth-first search, breadth-first search, trees, graphs, hash tables, and searching and sorting. It includes over 30 problems under each category.

Uploaded by

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

Array

1. Find Missing Observations


2. Sign of the Product of an Array
3. Spiral Matrix
4. Find N Unique Integers Sum up to Zero
5. Product of Array Except Self
6. Merge Intervals
7. Maximum Subarray
8. Median of Two Sorted Arrays
9. Coin Change
10. Maximal Square
11. Merge Sorted Array
12. Best Time to Buy and Sell Stock
13. Search in Rotated Sorted Array
14. 3Sum
15. Move Zeroes
16. Container With Most Water
17. Find All Duplicates in an Array
18. Kth Smallest Element in a Sorted Matrix
19. Maximum Product Subarray
20. Squares of a Sorted Array
21. Max Consecutive Ones III
22. Battleships in a Board
23. Find Minimum in Rotated Sorted Array
24. Count Primes
25. Majority Element
26. Game of Life
27. Minimum Size Subarray Sum
28. Shortest Unsorted Continuous Subarray
29. Subarray Sum Equals K
30. 4 Sum

Dynamic Programming (DP)

1. LRU Cache
2. Coin Change
3. Maximum Subarray
4. Minimum Path Sum
5. Unique Paths
6. House Robber
7. Word Break
8. Edit Distance
9. Maximum Product Subarray
10. Triangle
11. Best Time to Buy and Sell Stock II
12. Decode Ways
13. Jump Game
14. Unique Paths II
15. Distinct Subsequences
16. Palindromic Substrings
17. Longest Increasing Subsequence
18. Wildcard Matching
19. Best Time to Buy and Sell Stock with Cooldown
20. Unique Paths III
21. Maximum Product of Word Lengths
22. Maximum Length of Pair Chain
23. Maximal Square
24. Arithmetic Slices
25. Russian Doll Envelopes
26. Palindrome Partitioning II
27. Maximum Length of Repeated Subarray
28. Interleaving String
29. Maximum Non-Negative Product in a Matrix
30. Count Different Palindromic Subsequences

Strings

1. Reverse Words in a String


2. Reverse Words in a String III
3. Longest Substring Without Repeating Characters
4. String to Integer (atoi)
5. Valid Parentheses
6. Letter Combinations of a Phone Number
7. Palindrome Linked List
8. Valid Palindrome
9. Longest Palindromic Substring
10. Longest Palindromic Subsequence
11. Group Anagrams
12. Minimum Window Substring
13. Longest Common Prefix
14. Edit Distance
15. Valid Palindrome II
16. Permutation in String
17. Count and Say
18. Add Binary
19. ZigZag Conversion
20. Minimum Window Substring
21. Minimum Remove to Make Valid Parentheses
22. String Compression
23. Count Substrings with Only One Distinct Letter
24. Longest Word in Dictionary through Deleting
25. Reorder Data in Log Files
26. Generate Parentheses
27. Roman to Integer
28. Valid Anagram
29. Minimum Add to Make Parentheses Valid
30. Sort Characters By Frequency

Greedy

1. Minimum Add to Make Parentheses Valid


2. Container With Most Water
3. Bulb Switcher
4. Jump Game
5. Best Time to Buy and Sell Stock
6. Gas Station
7. Assign Cookies
8. Lemonade Change
9. Non-overlapping Intervals
10. Candy
11. Meeting Rooms II
12. Queue Reconstruction by Height
13. Boats to Save People
14. Minimize Max Distance to Gas Station
15. Two City Scheduling
16. Advantage Shuffle
17. Partition Labels
18. Koko Eating Bananas
19. Minimum Number of Arrows to Burst Balloons
20. Wiggle Subsequence
21. Jump Game II
22. Remove Covered Intervals
23. Is Subsequence
24. Partition Array into Disjoint Intervals
25. Teemo Attacking
26. Best Time to Buy and Sell Stock with Cooldown
27. Jump Game VI
28. Maximum Ice Cream Bars
29. Maximum Units on a Truck
30. Find the Most Competitive Subsequence

Depth-First Search (DFS)

1. Number of Islands
2. Serialize and Deserialize Binary Tree
3. Binary Tree Maximum Path Sum
4. Path Sum
5. Surrounded Regions
6. Word Search
7. Graph Valid Tree
8. Number of Connected Components in an Undirected Graph
9. Pacific Atlantic Water Flow
10. Island Perimeter
11. Flatten Binary Tree to Linked List
12. Maximum Depth of N-ary Tree
13. Count Complete Tree Nodes
14. Binary Tree Right Side View
15. Word Search II
16. Target Sum
17. Path Sum II
18. Symmetric Tree
19. Validate Binary Search Tree
20. Subtree of Another Tree
21. Redundant Connection
22. Flatten a Multilevel Doubly Linked List
23. Path Sum III
24. All Paths From Source to Target
25. Word Ladder II
26. Lowest Common Ancestor of a Binary Tree
27. Path Sum IV
28. Lowest Common Ancestor of a Binary Search Tree
29. Recover Binary Search Tree
30. Diameter of N-ary Tree

Breadth-First Search (BFS)

1. Word Ladder
2. Binary Tree Level Order Traversal
3. Populating Next Right Pointers in Each Node
4. Minimum Genetic Mutation
5. Shortest Path in Binary Matrix
6. Open the Lock
7. Word Ladder II
8. As Far from Land as Possible
9. Shortest Path Visiting All Nodes
10. Snakes and Ladders
11. Cousins in Binary Tree
12. Bus Routes
13. Jump Game III
14. Number of Recent Calls
15. Cheapest Flights Within K Stops
16. Symmetric Tree
17. Vertical Order Traversal of a Binary Tree
18. Network Delay Time
19. Minimum Knight Moves
20. Cut Off Trees for Golf Event
21. Shortest Distance from All Buildings
22. Rotting Oranges
23. Snakes and Ladders
24. Minesweeper
25. Open the Lock
26. Flood Fill
27. Rotten Oranges
28. Perfect Squares
29. Jump Game IV
30. Shortest Path in Binary Grid with Obstacles Elimination

Trees

1. Binary Tree Level Order Traversal


2. Binary Tree Zigzag Level Order Traversal
3. Validate Binary Search Tree
4. Construct Binary Tree from Inorder and Postorder Traversal
5. Symmetric Tree
6. Minimum Depth of Binary Tree
7. Binary Tree Maximum Path Sum
8. Path Sum
9. Subtree of Another Tree
10. Same Tree
11. Populating Next Right Pointers in Each Node
12. Binary Tree Vertical Order Traversal
13. Invert Binary Tree
14. Binary Tree Right Side View
15. Unique Binary Search Trees II
16. Maximum Depth of Binary Tree
17. Kth Smallest Element in a BST
18. Flatten Binary Tree to Linked List
19. Convert Sorted Array to Binary Search Tree
20. Lowest Common Ancestor of a Binary Tree
21. Merge Two Binary Trees
22. Find Mode in Binary Search Tree
23. Delete Node in a BST
24. Closest Binary Search Tree Value
25. Binary Tree Pruning
26. Find Bottom Left Tree Value
27. Balanced Binary Tree
28. Binary Tree Paths
29. Sum of Left Leaves
30. Second Minimum Node In a Binary Tree

Graph

1. Number of Islands
2. Clone Graph
3. Course Schedule II
4. Pacific Atlantic Water Flow
5. Is Graph Bipartite?
6. Network Delay Time
7. Graph Valid Tree
8. Cheapest Flights Within K Stops
9. All Paths From Source to Target
10. Shortest Path Visiting All Nodes
11. Find the Town Judge
12. Brick Wall
13. Redundant Connection
14. Accounts Merge
15. Most Stones Removed with Same Row or Column
16. Valid Tree
17. Number of Connected Components in an Undirected Graph
18. Bus Routes
19. Sentence Similarity II
20. Evaluate Division
21. Minimum Height Trees
22. Optimize Water Distribution in a Village
23. Detect Cycles in 2D Grid
24. Reconstruct Itinerary
25. Keys and Rooms
26. Sentence Similarity
27. Longest Increasing Path in a Matrix
28. Making A Large Island
29. Escape a Large Maze
30. Find the City With the Smallest Number of Neighbors at a Threshold Distance

Hash Table

1. Two Sum
2. Group Anagrams
3. Valid Parentheses
4. First Unique Character in a String
5. Intersection of Two Arrays
6. Subarray Sum Equals K
7. Contains Duplicate
8. Design HashMap
9. Palindrome Permutation
10. Keyboard Row
11. Valid Anagram
12. Insert Delete GetRandom O(1)
13. Longest Substring Without Repeating Characters
14. Custom Sort String
15. Find All Anagrams in a String
16. Find the Difference
17. Single Number
18. Four Sum II
19. Minimum Index Sum of Two Lists
20. Word Pattern
21. Contains Duplicate II
22. Isomorphic Strings
23. Intersection of Two Arrays II
24. Longest Word in Dictionary
25. Fraction to Recurring Decimal
26. Top K Frequent Elements
27. Anagrams
28. Find All Duplicates in an Array
29. Most Common Word
30. Longest Consecutive Sequence

Searching and Sorting

1. Search in Rotated Sorted Array


2. Merge Intervals
3. Find Minimum in Rotated Sorted Array
4. Search a 2D Matrix
5. Find First and Last Position of Element in Sorted Array
6. Search a 2D Matrix II
7. Find Peak Element
8. Intersection of Three Sorted Arrays
9. Kth Smallest Element in a Sorted Matrix
10. Peak Index in a Mountain Array
11. Find First and Last Position of Element in Sorted Array
12. Time Based Key-Value Store
13. Check If a Number Is Majority Element in a Sorted Array
14. Capacity To Ship Packages Within D Days
15. Find the Duplicate Number
16. Minimum Size Subarray Sum
17. Median of Two Sorted Arrays
18. Squares of a Sorted Array
19. Longest Increasing Subsequence
20. Find K Closest Elements
21. H-Index II
22. Count of Smaller Numbers After Self
23. Minimum Number of Arrows to Burst Balloons
24. Find Right Interval
25. Maximum Number of Events That Can Be Attended
26. Smallest Range Covering Elements from K Lists
27. Wiggle Sort II
28. Count Primes
29. Missing Number
30. Longest Subarray of 1's After Deleting One Element

Bit Manipulation
1. Single Number
2. Number of 1 Bits
3. Reverse Bits
4. Counting Bits
5. Power of Two
6. Single Number II
7. Bitwise AND of Numbers Range
8. Bitwise ORs of Subarrays
9. Minimum Number of Flips to Convert Binary Matrix to Zero Matrix
10. Maximum Product of Word Lengths
11. Binary Watch
12. Single Number III
13. Bitwise AND of Numbers Range
14. Total Hamming Distance
15. Count Triplets That Can Form Two Arrays of Equal XOR
16. Minimum XOR Sum of Two Arrays
17. Maximum XOR of Two Numbers in an Array
18. Maximum XOR With an Element From Array
19. Count Pairs with XOR in a Range
20. Maximum XOR With an Element From Array
21. Bitwise ORs of Subarrays
22. Sum of Two Integers
23. Maximum Score From Removing Stones
24. Minimum Swaps to Make Sequences Increasing
25. Minimum Changes To Make Alternating Binary String
26. Longest Line of Consecutive One in Matrix
27. Maximum Score Words Formed by Letters
28. Maximum Points You Can Obtain from Cards
29. XOR Queries of a Subarray
30. Find the Maximum XOR Pairs in an Array

Stack

1. Min Stack
2. Evaluate Reverse Polish Notation
3. Next Greater Element I
4. Baseball Game
5. Remove All Adjacent Duplicates In String
6. Decode String
7. Valid Parentheses
8. Remove Outermost Parentheses
9. Online Stock Span
10. Design a Stack With Increment Operation
11. Remove K Digits
12. Largest Rectangle in Histogram
13. Backspace String Compare
14. Remove Sub-Folders from the Filesystem
15. Maximum Frequency Stack
16. Reverse Substrings Between Each Pair of Parentheses
17. Remove All Adjacent Duplicates in String II
18. Design Browser History
19. Simplify Path
20. Score of Parentheses
21. Make The String Great
22. Check If Word Is Valid After Substitutions
23. Design Front Middle Back Queue
24. Remove All Adjacent Duplicates in String III
25. Maximum Nesting Depth of the Parentheses
26. Baseball Game
27. Minimum Remove to Make Valid Parentheses
28. Implement Queue using Stacks
29. Next Greater Node In Linked List
30. Build Binary Expression Tree From Infix Expression

Queue

1. Design Circular Queue


2. Design Hit Counter
3. Moving Average from Data Stream
4. Number of Recent Calls
5. Implement Stack using Queues
6. Design Snake Game
7. First Unique Number
8. Design Phone Directory
9. My Circular Queue
10. Sliding Window Maximum
11. Reveal Cards In Increasing Order
12. As Far from Land as Possible
13. MyQueue - Implement Queue using Stacks
14. Max Value of Equation
15. Implement Stack using Queues
16. Rearrange Spaces Between Words
17. Frog Position After T Seconds
18. Jump Game III
19. First Unique Number
20. Number of Recent Calls
21. Max Sum of Rectangle No Larger Than K
22. Remove Max Number of Edges to Keep Graph Fully Traversable
23. Find Median from Data Stream
24. Queue Reconstruction by Height
25. Valid Parenthesis String
26. Rearrange Spaces Between Words
27. Binary Tree Right Side View
28. Cut Off Trees for Golf Event
29. The Maze
30. Sliding Puzzle
Linked List

1. Add Two Numbers


2. Merge Two Sorted Lists
3. Intersection of Two Linked Lists
4. Remove Nth Node From End of List
5. Palindrome Linked List
6. Reverse Linked List
7. Copy List with Random Pointer
8. Design Linked List
9. Partition List
10. Odd Even Linked List
11. Rotate List
12. Remove Linked List Elements
13. Add Two Numbers II
14. Swap Nodes in Pairs
15. Reverse Linked List II
16. Split Linked List in Parts
17. Intersection of Two Linked Lists II
18. Palindrome Linked List II
19. Linked List Cycle
20. Remove Duplicates from Sorted List
21. Remove Zero Sum Consecutive Nodes from Linked List
22. Reverse Nodes in k-Group
23. Next Greater Node In Linked List
24. Convert Sorted List to Binary Search Tree
25. Add Two Numbers in Form of Linked List
26. Remove Linked List Elements II
27. Reverse Nodes in k-Group
28. Add Two Polynomials Represented as Linked Lists
29. Intersection of Three Sorted Lists
30. Detect Cycles in 2D Grid

Heap

1. Top K Frequent Elements


2. Find Median from Data Stream
3. Kth Largest Element in an Array
4. Find K Pairs with Smallest Sums
5. Sort Characters By Frequency
6. Find the Most Competitive Subsequence
7. The Skyline Problem
8. Kth Smallest Element in a Sorted Matrix
9. Find the Kth Smallest Sum of a Matrix With Sorted Rows
10. Minimum Number of Refueling Stops
11. Maximize Sum Of Array After K Negations
12. Maximum Performance of a Team
13. Kth Largest Element in a Stream
14. Connect Ropes to Minimize Cost
15. Last Stone Weight
16. Find the City With the Smallest Number of Neighbors at a Threshold Distance
17. Median Stream from Data Stream
18. Number of Orders in the Backlog
19. Maximum Ice Cream Bars
20. IPO (Initial Public Offering)
21. Maximum Profit in Job Scheduling
22. Maximum Number of Eaten Apples
23. Last Stone Weight II
24. Minimum Cost to Connect Sticks
25. Furthest Building You Can Reach
26. Number of Strings That Appear as Substrings in Word
27. Minimum Limit of Balls in a Bag
28. Kth Smallest Element in a Sorted Matrix II
29. Minimum Number of Work Sessions to Finish the Tasks
30. Maximum Number of Eaten Apples

Sliding Window

1. Minimum Size Subarray Sum


2. Sliding Window Maximum
3. Longest Substring Without Repeating Characters
4. Maximum Points You Can Obtain from Cards
5. Minimum Operations to Reduce X to Zero
6. Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit
7. Max Consecutive Ones III
8. Fruit Into Baskets
9. Max Consecutive Ones
10. Max Consecutive Ones II
11. Subarray Product Less Than K
12. Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold
13. Max Consecutive Ones IV
14. Get Equal Substrings Within Budget
15. Longest Continuous Increasing Subsequence
16. Longest Continuous Subarray With One and Zero
17. Constrained Subsequence Sum
18. Longest Turbulent Subarray
19. Maximum Erasure Value
20. Replace the Substring for Balanced String
21. Min Swaps to Group All 1's Together
22. Minimum Number of Days to Make m Bouquets
23. Max Consecutive Ones V
24. Minimum Swaps to Make Strings Equal
25. Longest Continuous Increasing Subsequence II
26. Number of Substrings Containing All Three Characters
27. Maximum Points from Cards
28. Maximum Vowels in a Substring of Given Length
29. Maximum Score Words Formed by Letters
30. Maximum Number of Vowels in a Substring of Given Length

Tree

1. Binary Tree Zigzag Level Order Traversal


2. Validate Binary Search Tree
3. Lowest Common Ancestor of a Binary Tree
4. Maximum Depth of Binary Tree
5. Construct Binary Tree from Preorder and Inorder Traversal
6. Same Tree
7. Symmetric Tree
8. Binary Tree Level Order Traversal
9. Path Sum
10. Invert Binary Tree
11. Populating Next Right Pointers in Each Node
12. Binary Tree Maximum Path Sum
13. Balanced Binary Tree
14. Count Complete Tree Nodes
15. Subtree of Another Tree
16. Binary Tree Preorder Traversal
17. Binary Tree Inorder Traversal
18. Binary Tree Postorder Traversal
19. Maximum Width of Binary Tree
20. Range Sum of BST
21. All Elements in Two Binary Search Trees
22. Binary Search Tree Iterator
23. Unique Binary Search Trees II
24. Sum of Root To Leaf Binary Numbers
25. Find Mode in Binary Search Tree
26. Minimum Distance Between BST Nodes
27. Delete Node in a BST
28. Second Minimum Node In a Binary Tree
29. Leaf-Similar Trees
30. Subtree with All Deepest Nodes

Backtracking

1. Letter Combinations of a Phone Number


2. Generate Parentheses
3. Subsets
4. Permutations
5. Palindrome Partitioning
6. Combination Sum
7. Word Search II
8. Expression Add Operators
9. Permutation Sequence
10. Regular Expression Matching
11. Sudoku Solver
12. N-Queens
13. Word Search
14. Restore IP Addresses
15. Split Array into Fibonacci Sequence
16. Partition to K Equal Sum Subsets
17. Combination Sum II
18. Regular Expression Matching
19. Palindromic Substrings
20. Beautiful Arrangement
21. Increasing Subsequences
22. Word Squares
23. Count Different Palindromic Subsequences
24. Maximum Length of a Concatenated String with Unique Characters
25. Letter Tile Possibilities
26. Unique Paths III
27. Beautiful Arrangement II
28. Matchsticks to Square
29. Stickers to Spell Word
30. Expression Add Operators

You might also like