Data Structures and Algorithms (DSA)
This document provides a curated list of Data Structures and Algorithms (DSA) questions commonly asked in technical interviews. It covers a wide range of difficulty levels and topics.
This is updated frequently but right now this is the most exhaustive list of type of questions being asked.
| Sno | Problem Title | Practice Links | Companies Asking | Difficulty | Topics | 
|---|---|---|---|---|---|
| 1 | Two Number Sum | LeetCode Two Sum | Google, Facebook, Amazon | Easy | Array, Hashing | 
| 2 | Reverse Linked List | LeetCode Reverse Linked List | Amazon, Facebook, Microsoft | Easy | Linked List | 
| 3 | Valid Parentheses | LeetCode Valid Parentheses | Amazon, Facebook, Google | Easy | Stack, String | 
| 4 | Binary Search | LeetCode Binary Search | Google, Facebook, Amazon | Easy | Array, Binary Search | 
| 5 | Merge Two Sorted Arrays | LeetCode Merge Sorted Array | Google, Microsoft, Amazon | Easy | Array, Two Pointers | 
| 6 | Meeting Rooms | LeetCode Meeting Rooms II | Microsoft, Google | Medium | Array, Sorting, Interval Scheduling | 
| 7 | Climbing Stairs | LeetCode Climbing Stairs | Amazon, Facebook, Google | Easy | Dynamic Programming | 
| 8 | Valid Anagram | LeetCode Valid Anagram | Google, Amazon | Easy | String, Hashing | 
| 9 | Longest Substring Without Repeating Characters | LeetCode Longest Substring Without Repeating Characters | Amazon, Facebook, Google | Medium | String, Hashing, Sliding Window | 
| 10 | Maximum Subarray (Kadane's Algorithm) | LeetCode Maximum Subarray | Google, Amazon, Facebook | Medium | Array, Dynamic Programming | 
| 11 | Word Ladder | LeetCode Word Ladder | Google, Amazon, Facebook | Very Hard | Graph, BFS, String Transformation | 
| 12 | 4Sum (Four Number Sum) | LeetCode 4Sum | Amazon, Facebook, Google | Hard | Array, Hashing, Two Pointers | 
| 13 | Median of Two Sorted Arrays | LeetCode Median of Two Sorted Arrays | Google, Amazon, Microsoft | Hard | Array, Binary Search | 
| 14 | Longest Increasing Subsequence | LeetCode Longest Increasing Subsequence | Google, Facebook, Amazon | Hard | Array, Dynamic Programming | 
| 15 | Longest Palindromic Substring | LeetCode Longest Palindromic Substring | Amazon, Google | Hard | String, Dynamic Programming | 
| 16 | Design LRU Cache | LeetCode LRU Cache | Amazon, Facebook, Google, Microsoft | Hard | Design, Hashing, Linked List | 
| 17 | Top K Frequent Elements | LeetCode Top K Frequent Elements | Google, Facebook, Amazon | Medium | Array, Hashing, Heap | 
| 18 | Find Peak Element | LeetCode Find Peak Element | Google, Facebook, Amazon | Medium | Array, Binary Search | 
| 19 | Candy (Min Rewards) | LeetCode Candy | Amazon, Facebook, Google | Hard | Array, Greedy | 
| 20 | Array of Products | LeetCode Product of Array Except Self | Amazon, Google | Medium | Array, Prefix/Suffix Products | 
| 21 | First Duplicate Value | LeetCode Find the Duplicate Number | Google, Facebook | Medium | Array, Hashing | 
| 22 | Validate Subsequence | GFG Validate Subsequence | Amazon, Google, Microsoft | Easy | Array, Two Pointers | 
| 23 | Nth Fibonacci | LeetCode Fibonacci Number | Google, Facebook, Microsoft | Easy | Recursion, Dynamic Programming | 
| 24 | Spiral Traverse | LeetCode Spiral Matrix | Facebook, Amazon, Google | Medium | Matrix, Simulation | 
| 25 | Subarray Sort | GFG Minimum Unsorted Subarray | Google, Uber | Hard | Array, Two Pointers | 
| 26 | Largest Range | GFG Largest Range | Google, Amazon | Hard | Array, Hashing | 
| 27 | Diagonal Traverse | LeetCode Diagonal Traverse | Google, Facebook | Medium | Array, Simulation | 
| 28 | Longest Peak | GFG Longest Peak | Google, Uber | Medium | Array, Dynamic Programming | 
| 29 | Product Sum | GFG Product Sum | Amazon, Facebook, Google | Easy | Array, Recursion | 
| 30 | Merge Two Sorted Lists | LeetCode Merge Two Sorted Lists | Google, Amazon, Facebook | Medium | Linked List, Recursion | 
| 31 | Binary Tree Level Order Traversal | LeetCode Level Order Traversal | Amazon, Google, Microsoft | Easy | Tree, BFS | 
| 32 | Longest Valid Parentheses | LeetCode Longest Valid Parentheses | Facebook, Google, Amazon | Medium | String, Stack, Dynamic Programming | 
| 33 | Word Break | LeetCode Word Break | Amazon, Google, Facebook | Hard | Dynamic Programming, String | 
| 34 | Find Median from Data Stream | LeetCode Find Median from Data Stream | Facebook, Amazon, Google | Hard | Heap, Data Structures | 
| 35 | Longest Repeating Character Replacement | LeetCode Longest Repeating Character Replacement | Google, Amazon, Facebook | Hard | String, Sliding Window, Greedy | 
| 36 | Kth Largest Element in an Array | LeetCode Kth Largest Element | Google, Amazon, Facebook | Medium | Heap, Sorting | 
| 37 | River Sizes | GFG River Sizes | Facebook, Google | Very Hard | Graph, DFS/BFS, Matrix | 
| 38 | Youngest Common Ancestor | LeetCode Lowest Common Ancestor | Google, Microsoft | Very Hard | Tree, Ancestor Tracking | 
| 39 | BST Construction | LeetCode Validate BST | Facebook, Amazon, Google | Very Hard | Tree, Binary Search Tree | 
| 40 | Invert Binary Tree | LeetCode Invert Binary Tree | Amazon, Facebook, Google | Very Hard | Tree, Recursion | 
| 41 | Validate BST | LeetCode Validate BST | Google, Amazon | Very Hard | Tree, Binary Search Tree | 
| 42 | Node Depths | GFG Sum of Node Depths | Google, Facebook | Very Hard | Tree, Recursion | 
| 43 | Branch Sums | GFG Branch Sums | Amazon, Facebook, Google | Very Hard | Tree, Recursion | 
| 44 | Find Successor | LeetCode Inorder Successor | Facebook, Amazon, Google | Very Hard | Tree, BST, Inorder Traversal | 
| 45 | Binary Tree Diameter | GFG Diameter of Binary Tree | Google, Uber | Very Hard | Tree, Recursion | 
| 46 | Lowest Common Ancestor | LeetCode Lowest Common Ancestor | Amazon, Facebook, Google | Very Hard | Tree, Recursion | 
| 47 | Dijkstra's Algorithm | LeetCode Network Delay Time | Google, Amazon | Very Hard | Graph, Shortest Paths, Greedy | 
| 48 | Topological Sort | GFG Topological Sort | Google, Microsoft, Amazon | Very Hard | Graph, DFS/BFS, Sorting | 
| 49 | Knapsack Problem | LeetCode Coin Change 2 | Facebook, Amazon, Google | Very Hard | Dynamic Programming, Knapsack | 
| 50 | Disk Stacking | GFG Disk Stacking | Google, Facebook | Very Hard | Dynamic Programming, Sorting | 
| 51 | Numbers In Pi | N/A | Google, Facebook | Very Hard | Dynamic Programming, String Processing | 
| 52 | Longest Common Subsequence | LeetCode Longest Common Subsequence | Amazon, Google, Microsoft | Very Hard | Dynamic Programming, Strings | 
| 53 | Min Number of Jumps | LeetCode Min Number of Jumps | Google, Facebook, Amazon | Very Hard | Dynamic Programming, Greedy | 
| 54 | Water Area (Trapping Rain Water) | LeetCode Trapping Rain Water | Google, Amazon, Facebook | Very Hard | Array, Two Pointers, Greedy | 
| 55 | Minimum Characters For Palindrome | GFG Minimum Characters For Palindrome | Amazon, Google | Very Hard | String, Dynamic Programming, KMP | 
| 56 | Regular Expression Matching | LeetCode Regular Expression Matching | Google, Amazon, Facebook | Very Hard | Dynamic Programming, Strings, Recursion | 
| 57 | Wildcard Matching | LeetCode Wildcard Matching | Amazon, Google | Very Hard | Dynamic Programming, Strings | 
| 58 | Group Anagrams | LeetCode Group Anagrams | Google, Amazon, Facebook | Medium | Array, Hashing | 
| 59 | Longest Consecutive Sequence | LeetCode Longest Consecutive Sequence | Facebook, Google, Amazon | Hard | Array, Hashing | 
| 60 | Maximum Product Subarray | LeetCode Maximum Product Subarray | Amazon, Google, Facebook | Medium | Array, Dynamic Programming | 
| 61 | Sum of Two Integers (Bit Manipulation) | LeetCode Sum of Two Integers | Google, Amazon, Facebook | Medium | Bit Manipulation | 
| 62 | Course Schedule | LeetCode Course Schedule | Amazon, Facebook, Google | Medium | Graph, DFS/BFS | 
| 63 | Add Two Numbers (Linked List) | LeetCode Add Two Numbers | Google, Facebook, Amazon | Medium | Linked List, Math | 
| 64 | Reverse Words in a String | LeetCode Reverse Words in a String | Google, Amazon, Facebook | Medium | String, Two Pointers | 
| 65 | Intersection of Two Arrays | LeetCode Intersection of Two Arrays | Amazon, Google, Facebook | Easy | Array, Hashing | 
| 66 | Find All Duplicates in an Array | LeetCode Find All Duplicates | Facebook, Google, Amazon | Medium | Array, Hashing | 
| 67 | Majority Element | LeetCode Majority Element | Google, Amazon | Easy | Array, Hashing, Boyer-Moore | 
| 68 | Rotate Array | LeetCode Rotate Array | Amazon, Google, Facebook | Medium | Array, Two Pointers | 
| 69 | Spiral Matrix II | LeetCode Spiral Matrix II | Google, Facebook, Amazon | Medium | Matrix, Simulation | 
| 70 | Search in Rotated Sorted Array | LeetCode Search in Rotated Sorted Array | Google, Amazon, Facebook | Medium | Array, Binary Search | 
| 71 | Design a URL Shortener | LeetCode Design TinyURL | Uber, Airbnb, Flipkart | Medium | Design, Hashing, Strings | 
| 72 | Implement Autocomplete System | GFG Autocomplete System | Amazon, Google, Swiggy | Hard | Trie, Design, Strings | 
| 73 | Design Twitter Feed | LeetCode Design Twitter | Twitter, Flipkart, Ola | Medium | Design, Heap, Linked List | 
| 74 | Implement LFU Cache | GFG LFU Cache | Amazon, Paytm, Flipkart | Hard | Design, Hashing | 
| 75 | Design a Rate Limiter | N/A | Uber, Ola, Swiggy | Medium | Design, Algorithms | 
| 76 | Serialize and Deserialize Binary Tree | LeetCode Serialize and Deserialize Binary Tree | Amazon, Microsoft, Swiggy | Hard | Tree, DFS, Design | 
| 77 | Design a File System | LeetCode Design File System | Google, Flipkart, Amazon | Hard | Design, Trie | 
| 78 | Implement Magic Dictionary | LeetCode Implement Magic Dictionary | Facebook, Microsoft, Paytm | Medium | Trie, Design | 
| 79 | Longest Substring with At Most K Distinct Characters | LeetCode Longest Substring with At Most K Distinct Characters | Amazon, Google | Medium | String, Sliding Window | 
| 80 | Subarray Sum Equals K | LeetCode Subarray Sum Equals K | Microsoft, Amazon, Flipkart | Medium | Array, Hashing, Prefix Sum | 
| 81 | Merge k Sorted Lists | LeetCode Merge k Sorted Lists | Google, Facebook, Amazon | Hard | Heap, Linked List | 
| 82 | Longest Increasing Path in a Matrix | LeetCode Longest Increasing Path | Google, Microsoft | Hard | DFS, DP, Matrix | 
| 83 | Design a Stock Price Fluctuation Tracker | LeetCode Stock Price Fluctuation | Amazon, Flipkart, Paytm | Medium | Design, Heap | 
| 84 | Implement a Trie | LeetCode Implement Trie | Amazon, Google, Microsoft | Medium | Trie, Design | 
| 85 | Design a Chat System | Medium: Chat System Design (free article) | WhatsApp, Slack, Swiggy | Hard | Design, Messaging | 
| 86 | Design an Elevator System | N/A | OYO, Ola, Flipkart | Hard | Design, System Design | 
| 87 | Implement a Sudoku Solver | LeetCode Sudoku Solver | Google, Microsoft, Amazon | Hard | Backtracking, Recursion | 
| 88 | Find All Anagrams in a String | LeetCode Find All Anagrams in a String | Facebook, Google | Medium | String, Sliding Window, Hashing | 
| 89 | Design Twitter-like Feed | LeetCode Design Twitter | Twitter, Facebook, Uber | Medium | Design, Heap, Linked List | 
| 90 | Longest Palindromic Subsequence | LeetCode Longest Palindromic Subsequence | Amazon, Google | Medium | DP, String | 
| 91 | Clone Graph | LeetCode Clone Graph | Amazon, Google | Medium | Graph, DFS/BFS | 
| 92 | Design a Data Structure for the Stock Span Problem | LeetCode Online Stock Span | Amazon, Microsoft, Paytm | Medium | Stack, Array, Design | 
| 93 | Design a Stack That Supports getMin() | LeetCode Min Stack | Facebook, Amazon, Google | Easy | Stack, Design | 
| 94 | Convert Sorted Array to Binary Search Tree | LeetCode Sorted Array to BST | Facebook, Google | Easy | Tree, Recursion | 
| 95 | Meeting Rooms II | LeetCode Meeting Rooms II | Microsoft, Google | Medium | Array, Heap, Sorting | 
| 96 | Search in Rotated Sorted Array | LeetCode Search in Rotated Sorted Array | Google, Amazon, Facebook | Medium | Array, Binary Search | 
| 97 | Design a URL Shortener | LeetCode Design TinyURL | Uber, Airbnb, Flipkart | Medium | Design, Hashing, Strings | 
| 98 | Implement Autocomplete System | GFG Autocomplete System | Amazon, Google, Swiggy | Hard | Trie, Design, Strings | 
| 99 | Design Twitter Feed | LeetCode Design Twitter | Twitter, Flipkart, Ola | Medium | Design, Heap, Linked List | 
| 100 | Implement LFU Cache | GFG LFU Cache | Amazon, Paytm, Flipkart | Hard | Design, Hashing | 
Questions asked in Google interview
- Two Number Sum
- Valid Parentheses
- Binary Search
- Merge Two Sorted Arrays
- Meeting Rooms
- Climbing Stairs
- Valid Anagram
- Longest Substring Without Repeating Characters
- Maximum Subarray (Kadane's Algorithm)
- Word Ladder
- 4Sum (Four Number Sum)
- Median of Two Sorted Arrays
- Longest Increasing Subsequence
- Longest Palindromic Substring
- Design LRU Cache
- Top K Frequent Elements
- Find Peak Element
- Candy (Min Rewards)
- Array of Products
- First Duplicate Value
- Validate Subsequence
- Nth Fibonacci
- Spiral Traverse
- Largest Range
- Diagonal Traverse
- Longest Peak
- Product Sum
- Merge Two Sorted Lists
- Binary Tree Level Order Traversal
- Longest Valid Parentheses
- Word Break
- Find Median from Data Stream
- Longest Repeating Character Replacement
- Kth Largest Element in an Array
- River Sizes
- Youngest Common Ancestor
- BST Construction
- Invert Binary Tree
- Validate BST
- Node Depths
- Branch Sums
- Find Successor
- Binary Tree Diameter
- Lowest Common Ancestor
- Dijkstra's Algorithm
- Topological Sort
- Knapsack Problem
- Disk Stacking
- Numbers In Pi
- Longest Common Subsequence
- Min Number of Jumps
- Water Area (Trapping Rain Water)
- Minimum Characters For Palindrome
- Regular Expression Matching
- Wildcard Matching
- Group Anagrams
- Longest Consecutive Sequence
- Maximum Product Subarray
- Sum of Two Integers (Bit Manipulation)
- Course Schedule
- Add Two Numbers (Linked List)
- Reverse Words in a String
- Intersection of Two Arrays
- Find All Duplicates in an Array
- Majority Element
- Rotate Array
- Spiral Matrix II
- Search in Rotated Sorted Array
- Implement Autocomplete System
- Design a File System
- Longest Substring with At Most K Distinct Characters
- Merge k Sorted Lists
- Longest Increasing Path in a Matrix
- Implement a Trie
- Implement a Sudoku Solver
- Find All Anagrams in a String
- Longest Palindromic Subsequence
- Clone Graph
- Design a Stack That Supports getMin()
- Convert Sorted Array to Binary Search Tree
- Meeting Rooms II
Questions asked in Facebook interview
- Two Number Sum
- Reverse Linked List
- Valid Parentheses
- Binary Search
- Merge Two Sorted Arrays
- Climbing Stairs
- Longest Substring Without Repeating Characters
- Maximum Subarray (Kadane's Algorithm)
- Word Ladder
- 4Sum (Four Number Sum)
- Longest Increasing Subsequence
- Design LRU Cache
- Top K Frequent Elements
- Find Peak Element
- Candy (Min Rewards)
- Array of Products
- First Duplicate Value
- Word Break
- Spiral Traverse
- Diagonal Traverse
- Product Sum
- Merge Two Sorted Lists
- Binary Tree Level Order Traversal
- Longest Valid Parentheses
- Find Median from Data Stream
- Longest Repeating Character Replacement
- Kth Largest Element in an Array
- River Sizes
- BST Construction
- Invert Binary Tree
- Node Depths
- Branch Sums
- Find Successor
- Lowest Common Ancestor
- Dijkstra's Algorithm
- Knapsack Problem
- Disk Stacking
- Numbers In Pi
- Longest Common Subsequence
- Min Number of Jumps
- Water Area (Trapping Rain Water)
- Regular Expression Matching
- Wildcard Matching
- Group Anagrams
- Longest Consecutive Sequence
- Maximum Product Subarray
- Sum of Two Integers (Bit Manipulation)
- Add Two Numbers (Linked List)
- Reverse Words in a String
- Intersection of Two Arrays
- Find All Duplicates in an Array
- Rotate Array
- Spiral Matrix II
- Search in Rotated Sorted Array
- Design a Stack That Supports getMin()
- Convert Sorted Array to Binary Search Tree
Questions asked in Amazon interview
- Two Number Sum
- Valid Parentheses
- Binary Search
- Merge Two Sorted Arrays
- Climbing Stairs
- Valid Anagram
- Longest Substring Without Repeating Characters
- Maximum Subarray (Kadane's Algorithm)
- Word Ladder
- 4Sum (Four Number Sum)
- Median of Two Sorted Arrays
- Longest Increasing Subsequence
- Longest Palindromic Substring
- Design LRU Cache
- Top K Frequent Elements
- Find Peak Element
- Candy (Min Rewards)
- Array of Products
- First Duplicate Value
- Validate Subsequence
- Nth Fibonacci
- Spiral Traverse
- Largest Range
- Diagonal Traverse
- Longest Peak
- Product Sum
- Merge Two Sorted Lists
- Binary Tree Level Order Traversal
- Longest Valid Parentheses
- Word Break
- Find Median from Data Stream
- Longest Repeating Character Replacement
- Kth Largest Element in an Array
- River Sizes
- BST Construction
- Invert Binary Tree
- Validate BST
- Branch Sums
- Find Successor
- Lowest Common Ancestor
- Dijkstra's Algorithm
- Topological Sort
- Knapsack Problem
- Disk Stacking
- Numbers In Pi
- Longest Common Subsequence
- Min Number of Jumps
- Water Area (Trapping Rain Water)
- Minimum Characters For Palindrome
- Regular Expression Matching
- Wildcard Matching
- Group Anagrams
- Longest Consecutive Sequence
- Maximum Product Subarray
- Sum of Two Integers (Bit Manipulation)
- Course Schedule
- Add Two Numbers (Linked List)
- Reverse Words in a String
- Intersection of Two Arrays
- Find All Duplicates in an Array
- Majority Element
- Rotate Array
- Spiral Matrix II
- Search in Rotated Sorted Array
- Design a URL Shortener
- Implement Autocomplete System
- Design a File System
- Longest Substring with At Most K Distinct Characters
- Merge k Sorted Lists
- Implement a Trie
- Implement a Sudoku Solver
- Find All Anagrams in a String
- Longest Palindromic Subsequence
- Clone Graph
- Design a Stack That Supports getMin()
- Meeting Rooms II
Questions asked in Microsoft interview
- Reverse Linked List
- Merge Two Sorted Arrays
- Meeting Rooms
- Median of Two Sorted Arrays
- Nth Fibonacci
- Binary Tree Level Order Traversal
- Find Median from Data Stream
- Topological Sort
- Youngest Common Ancestor
- Longest Increasing Path in a Matrix
- Implement a Trie
- Implement a Sudoku Solver
- Convert Sorted Array to Binary Search Tree
- Meeting Rooms II
- Course Schedule
Questions asked in Uber interview
- Subarray Sort
- Longest Peak
- Binary Tree Diameter
- Design Twitter-like Feed
Questions asked in Swiggy interview
- Implement Autocomplete System
- Design a Rate Limiter
- Serialize and Deserialize Binary Tree
Questions asked in Flipkart interview
- Design a URL Shortener
- Design Twitter Feed
- Design a File System
- Subarray Sum Equals K
- Design an Elevator System
Questions asked in Ola interview
- Design Twitter Feed
- Design an Elevator System
Questions asked in Paytm interview
- Implement LFU Cache
- Design a Data Structure for the Stock Span Problem
- Implement Magic Dictionary
Questions asked in OYO interview
- Design an Elevator System
Questions asked in WhatsApp interview
- Design a Chat System
Questions asked in Slack interview
- Design a Chat System
Questions asked in Airbnb interview
- Design a URL Shortener