DSA & Algorithm practices
This is a curated list of essential DSA problems to practice and master key concepts. Each problem is grouped by category, and comes with an example prompt.
-
1. Find the maximum sum subarray
Example: Kadane's Algorithm -
2. Find all substrings that are palindromes
Example: Palindrome Partitioning -
3. Implement the "two sum" problem
Example: Two Sum -
4. Implement Kadane's algorithm for maximum subarray sum
Example: Maximum Subarray -
5. Find the missing number in an array of integers
Example: Missing Number -
6. Merge two sorted arrays into one sorted array
Example: Merge Sorted Array -
7. Check if a string is a palindrome
Example: Valid Palindrome -
8. Find the first non-repeating character in a string
Example: First Unique Character -
9. Remove duplicates from a sorted array
Example: Remove Duplicates
-
10. Reverse a linked list
Example: Reverse Linked List -
11. Detect a cycle in a linked list
Example: Linked List Cycle -
12. Find the middle of a linked list
Example: Middle of the Linked List -
13. Merge two sorted linked lists
Example: Merge Two Sorted Lists -
14. Implement a stack using linked list
Example: Custom implementation (no standard problem) -
15. Find the intersection point of two linked lists
Example: Intersection of Two Linked Lists
-
16. Implement a stack using an array
Example: Custom implementation -
17. Stack with min operation
Example: Min Stack -
18. Implement a circular queue
Example: Design Circular Queue -
19. Design a max stack
Example: Max Stack (Hard) -
20. Design a queue using stacks
Example: Implement Queue using Stacks
-
21. Find the height of a binary tree
Example: Maximum Depth of Binary Tree -
22. Find LCA of two nodes
Example: Lowest Common Ancestor -
23. Validate if a binary tree is BST
Example: Validate BST -
24. Serialize and deserialize a binary tree
Example: Serialize and Deserialize Binary Tree -
25. Inorder traversal
Example: Binary Tree Inorder Traversal -
26. Find the diameter of a binary tree
Example: Diameter of Binary Tree -
27. Convert to mirror tree
Example: Mirror Tree
-
28. Implement DFS
Example: Graph DFS Traversal -
29. Implement BFS
Example: Graph BFS Traversal -
30. Find shortest path (unweighted)
Example: 01 Matrix -
31. Detect a cycle (undirected graph, DFS)
Example: Cycle Detection -
32. Check if graph is bipartite
Example: Is Graph Bipartite? -
33. Count connected components
Example: Number of Provinces -
34. Find bridges in a graph
Example: Critical Connections
-
35. Implement bubble, insertion, selection, merge sort
Example: Manual implementation -
36. Implement quicksort
Example: Quicksort -
37. Implement binary search
Example: Binary Search -
38. Implement interpolation search
Example: Interpolation Search -
39. Kth smallest element
Example: Kth Smallest in Array -
40. Count inversions
Example: Count Inversions
🧮 Dynamic Programming
🔁 Backtracking
🔢 Hashing
📚 Heaps
🌲 Tries
🎯 Greedy Algorithms
💡 Tip: Track your progress by checking off problems as you solve them!