DEV Community

Cover image for The Ultimate Guide to Top 150 LeetCode Problems: Your Path to Acing Technical Interviews
Soham
Soham

Posted on

The Ultimate Guide to Top 150 LeetCode Problems: Your Path to Acing Technical Interviews

Master the most frequently asked coding interview questions from top tech companies


Introduction

Landing a job at a top tech company requires solid preparation. This comprehensive guide covers the Top 150 LeetCode problems that are most frequently asked in technical interviews at companies like Google, Amazon, Microsoft, Meta (Facebook), Apple, and many others.

Whether you're preparing for your first technical interview or brushing up your skills, this curated list will help you focus on what matters most. Each problem is tagged with the companies that have asked it, so you can tailor your preparation to your target employers.


πŸ“Š Array & String Problems

1. Two Sum

  • LeetCode Link: #1 Two Sum
  • Companies: Amazon, Google, Meta, Apple, Microsoft, Adobe, Bloomberg, Uber, Oracle, Yahoo

2. Merge Sorted Array

  • LeetCode Link: #88 Merge Sorted Array
  • Companies: Meta, Amazon, Microsoft, Apple, Bloomberg, Adobe, Oracle, Expedia, SAP

3. Remove Element

  • LeetCode Link: #27 Remove Element
  • Companies: Google, Amazon, Bloomberg, Microsoft, Adobe

4. Remove Duplicates from Sorted Array

5. Remove Duplicates from Sorted Array II

6. Majority Element

  • LeetCode Link: #169 Majority Element
  • Companies: Amazon, Google, Meta, Apple, Adobe, Microsoft, Uber, Oracle

7. Rotate Array

  • LeetCode Link: #189 Rotate Array
  • Companies: Amazon, Microsoft, Meta, Apple, Bloomberg, Adobe, Google

8. Best Time to Buy and Sell Stock

9. Best Time to Buy and Sell Stock II

10. Jump Game

  • LeetCode Link: #55 Jump Game
  • Companies: Amazon, Google, Meta, Microsoft, Apple, Adobe, Bloomberg

11. Jump Game II

  • LeetCode Link: #45 Jump Game II
  • Companies: Amazon, Meta, Google, Microsoft, Adobe, Apple

12. H-Index

  • LeetCode Link: #274 H-Index
  • Companies: Meta, Google, Amazon, Bloomberg

13. Insert Delete GetRandom O(1)

14. Product of Array Except Self

15. Gas Station

16. Candy

  • LeetCode Link: #135 Candy
  • Companies: Amazon, Google, Microsoft, Meta

17. Trapping Rain Water

18. Roman to Integer

  • LeetCode Link: #13 Roman to Integer
  • Companies: Amazon, Meta, Microsoft, Google, Apple, Adobe, Bloomberg, Yahoo

19. Integer to Roman

20. Length of Last Word

21. Longest Common Prefix

22. Reverse Words in a String

23. Zigzag Conversion

24. Find the Index of the First Occurrence in a String

25. Text Justification


πŸ” Two Pointers

26. Valid Palindrome

  • LeetCode Link: #125 Valid Palindrome
  • Companies: Amazon, Meta, Microsoft, Google, Apple, Adobe, Bloomberg

27. Is Subsequence

28. Two Sum II - Input Array Is Sorted

29. Container With Most Water

30. 3Sum

  • LeetCode Link: #15 3Sum
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg, Uber, Oracle

πŸ”„ Sliding Window

31. Minimum Size Subarray Sum

32. Longest Substring Without Repeating Characters

33. Substring with Concatenation of All Words

34. Minimum Window Substring


πŸ”’ Matrix

35. Valid Sudoku

  • LeetCode Link: #36 Valid Sudoku
  • Companies: Amazon, Google, Meta, Microsoft, Apple, Adobe, Bloomberg

36. Spiral Matrix

  • LeetCode Link: #54 Spiral Matrix
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg

37. Rotate Image

  • LeetCode Link: #48 Rotate Image
  • Companies: Amazon, Meta, Microsoft, Google, Apple, Adobe, Bloomberg

38. Set Matrix Zeroes

  • LeetCode Link: #73 Set Matrix Zeroes
  • Companies: Amazon, Meta, Microsoft, Google, Apple, Adobe, Bloomberg

39. Game of Life


πŸ”— HashMap

40. Ransom Note

  • LeetCode Link: #383 Ransom Note
  • Companies: Amazon, Meta, Microsoft, Google, Apple

41. Isomorphic Strings

42. Word Pattern

43. Valid Anagram

  • LeetCode Link: #242 Valid Anagram
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg

44. Group Anagrams

  • LeetCode Link: #49 Group Anagrams
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg, Uber

45. Two Sum

  • LeetCode Link: #1 Two Sum
  • Companies: Amazon, Google, Meta, Apple, Microsoft, Adobe, Bloomberg, Uber, Oracle, Yahoo

46. Happy Number

  • LeetCode Link: #202 Happy Number
  • Companies: Amazon, Google, Meta, Microsoft, Apple, Adobe

47. Contains Duplicate II

48. Longest Consecutive Sequence


πŸ“ Intervals

49. Summary Ranges

50. Merge Intervals

  • LeetCode Link: #56 Merge Intervals
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg, Uber, Oracle

51. Insert Interval

  • LeetCode Link: #57 Insert Interval
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg

52. Minimum Number of Arrows to Burst Balloons


πŸ“š Stack

53. Valid Parentheses

  • LeetCode Link: #20 Valid Parentheses
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg, Uber

54. Simplify Path

55. Min Stack

  • LeetCode Link: #155 Min Stack
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg, Uber

56. Evaluate Reverse Polish Notation

57. Basic Calculator

  • LeetCode Link: #224 Basic Calculator
  • Companies: Amazon, Google, Meta, Microsoft, Apple, Adobe, Bloomberg

πŸ”’ Linked List

58. Linked List Cycle

59. Add Two Numbers

  • LeetCode Link: #2 Add Two Numbers
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg, Uber

60. Merge Two Sorted Lists

61. Copy List with Random Pointer

62. Reverse Linked List II

63. Reverse Nodes in k-Group

64. Remove Nth Node From End of List

65. Remove Duplicates from Sorted List II

66. Rotate List

  • LeetCode Link: #61 Rotate List
  • Companies: Amazon, Meta, Microsoft, Bloomberg

67. Partition List

68. LRU Cache

  • LeetCode Link: #146 LRU Cache
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg, Uber, Oracle

🌳 Binary Tree General

69. Maximum Depth of Binary Tree

70. Same Tree

  • LeetCode Link: #100 Same Tree
  • Companies: Amazon, Google, Meta, Microsoft, Bloomberg

71. Invert Binary Tree

72. Symmetric Tree

  • LeetCode Link: #101 Symmetric Tree
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg

73. Construct Binary Tree from Preorder and Inorder Traversal

74. Construct Binary Tree from Inorder and Postorder Traversal

75. Populating Next Right Pointers in Each Node II

76. Flatten Binary Tree to Linked List

77. Path Sum

  • LeetCode Link: #112 Path Sum
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg

78. Sum Root to Leaf Numbers

79. Binary Tree Maximum Path Sum

80. Binary Search Tree Iterator

81. Count Complete Tree Nodes

82. Lowest Common Ancestor of a Binary Tree


πŸ” Binary Tree BFS

83. Binary Tree Right Side View

84. Average of Levels in Binary Tree

85. Binary Tree Level Order Traversal

86. Binary Tree Zigzag Level Order Traversal


πŸ”Ž Binary Search Tree

87. Minimum Absolute Difference in BST

88. Kth Smallest Element in a BST

89. Validate Binary Search Tree


πŸ“Š Graph General

90. Number of Islands

  • LeetCode Link: #200 Number of Islands
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg, Uber

91. Surrounded Regions

92. Clone Graph

  • LeetCode Link: #133 Clone Graph
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg

93. Evaluate Division

94. Course Schedule

  • LeetCode Link: #207 Course Schedule
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg

95. Course Schedule II


πŸ” Graph BFS

96. Snakes and Ladders

97. Minimum Genetic Mutation

98. Word Ladder

  • LeetCode Link: #127 Word Ladder
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg

πŸ”€ Trie

99. Implement Trie (Prefix Tree)

100. Design Add and Search Words Data Structure

101. Word Search II

  • LeetCode Link: #212 Word Search II
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg

πŸ”™ Backtracking

102. Letter Combinations of a Phone Number

103. Combinations

  • LeetCode Link: #77 Combinations
  • Companies: Amazon, Google, Meta, Microsoft, Bloomberg

104. Permutations

  • LeetCode Link: #46 Permutations
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg

105. Combination Sum

  • LeetCode Link: #39 Combination Sum
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg

106. N-Queens II

  • LeetCode Link: #52 N-Queens II
  • Companies: Amazon, Google, Meta, Microsoft, Apple, Adobe

107. Generate Parentheses

108. Word Search

  • LeetCode Link: #79 Word Search
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg

πŸ”’ Divide & Conquer

109. Convert Sorted Array to Binary Search Tree

110. Sort List

  • LeetCode Link: #148 Sort List
  • Companies: Amazon, Meta, Google, Microsoft, Adobe, Bloomberg

111. Construct Quad Tree

112. Merge k Sorted Lists


πŸ“¦ Kadane's Algorithm

113. Maximum Subarray

  • LeetCode Link: #53 Maximum Subarray
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg, Uber

114. Maximum Sum Circular Subarray


πŸ”’ Binary Search

115. Search Insert Position

116. Search a 2D Matrix

117. Find Peak Element

118. Search in Rotated Sorted Array

119. Find First and Last Position of Element in Sorted Array

120. Find Minimum in Rotated Sorted Array

121. Median of Two Sorted Arrays


πŸ”’ Heap

122. Kth Largest Element in an Array

123. IPO

  • LeetCode Link: #502 IPO
  • Companies: Amazon, Google, Meta, Microsoft

124. Find K Pairs with Smallest Sums

125. Find Median from Data Stream


πŸ”’ Bit Manipulation

126. Add Binary

  • LeetCode Link: #67 Add Binary
  • Companies: Amazon, Meta, Microsoft, Google, Apple, Adobe, Bloomberg

127. Reverse Bits

  • LeetCode Link: #190 Reverse Bits
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe

128. Number of 1 Bits

  • LeetCode Link: #191 Number of 1 Bits
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg

129. Single Number

  • LeetCode Link: #136 Single Number
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg

130. Single Number II

131. Bitwise AND of Numbers Range


πŸ“ˆ Math

132. Palindrome Number

  • LeetCode Link: #9 Palindrome Number
  • Companies: Amazon, Meta, Microsoft, Google, Apple, Adobe, Bloomberg

133. Plus One

  • LeetCode Link: #66 Plus One
  • Companies: Amazon, Google, Meta, Microsoft, Apple, Adobe

134. Factorial Trailing Zeroes

135. Sqrt(x)

  • LeetCode Link: #69 Sqrt(x)
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg

136. Pow(x, n)

  • LeetCode Link: #50 Pow(x, n)
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg

137. Max Points on a Line


πŸ”„ 1D Dynamic Programming

138. Climbing Stairs

  • LeetCode Link: #70 Climbing Stairs
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg, Uber

139. House Robber

  • LeetCode Link: #198 House Robber
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg

140. Word Break

  • LeetCode Link: #139 Word Break
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg

141. Coin Change

  • LeetCode Link: #322 Coin Change
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg, Uber

142. Longest Increasing Subsequence


πŸ“Š Multidimensional DP

143. Triangle

  • LeetCode Link: #120 Triangle
  • Companies: Amazon, Meta, Google, Microsoft, Adobe

144. Minimum Path Sum

  • LeetCode Link: #64 Minimum Path Sum
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg

145. Unique Paths II

146. Longest Palindromic Substring

147. Interleaving String

148. Edit Distance

  • LeetCode Link: #72 Edit Distance
  • Companies: Amazon, Meta, Google, Microsoft, Apple, Adobe, Bloomberg

149. Best Time to Buy and Sell Stock III

150. Best Time to Buy and Sell Stock IV


🎯 How to Use This Guide

1. Start with Easy Problems

Begin with the Array & String section and work your way through easy-level problems first. Build confidence before moving to medium and hard problems.

2. Focus on Patterns

Notice how problems are grouped by data structures and algorithms. Understanding these patterns will help you recognize similar problems during interviews.

3. Target Company-Specific Problems

If you're interviewing at a specific company (e.g., Amazon, Google), prioritize problems frequently asked by that company.

4. Practice Consistently

Aim to solve 2-3 problems daily. Consistency is more important than cramming.

5. Master the Fundamentals

Don't just memorize solutions. Understand:

  • Time complexity (Big O notation)
  • Space complexity
  • Trade-offs between different approaches
  • Edge cases and input validation

6. Mock Interviews

Practice explaining your thought process out loud. Communication is crucial in technical interviews.


πŸ“š Study Plan Suggestions

30-Day Sprint Plan

  • Week 1: Array, String, Two Pointers (5 problems/day)
  • Week 2: HashMap, Stack, Linked List (5 problems/day)
  • Week 3: Binary Tree, Graph, Binary Search (5 problems/day)
  • Week 4: Dynamic Programming, Backtracking, Review (5 problems/day)

60-Day Comprehensive Plan

  • Weeks 1-2: Arrays & Strings (3 problems/day)
  • Weeks 3-4: Two Pointers, Sliding Window, Matrix (3 problems/day)
  • Weeks 5-6: HashMap, Intervals, Stack (3 problems/day)
  • Weeks 7-8: Linked List, Binary Trees (2-3 problems/day)
  • Weeks 9-10: Graphs, Trie, Backtracking (2-3 problems/day)
  • Weeks 11-12: Dynamic Programming, Review (2-3 problems/day)

90-Day Deep Dive

  • Follow the 60-day plan but spend more time on:
    • Understanding multiple solutions per problem
    • Optimizing your initial solutions
    • Writing clean, production-quality code
    • Practicing system design basics alongside coding

πŸ’‘ Pro Tips for Success

  1. Understand Before Memorizing: Don't just memorize solutions. Understand the underlying principles and patterns.

  2. Write Clean Code: Practice writing readable code with proper variable names and comments during practice sessions.

  3. Handle Edge Cases: Always consider empty inputs, single elements, duplicates, and boundary conditions.

  4. Optimize Progressively: Start with a brute force solution, then optimize. Interviewers want to see your thought process.

  5. Learn from Mistakes: Review problems you got wrong. Understand why you struggled and what concept you need to reinforce.

  6. Time Yourself: Practice under time constraints to simulate real interview pressure.

  7. Use the Right Data Structure: Understanding when to use arrays, hash maps, heaps, or trees is crucial.

  8. Master Common Patterns: Two pointers, sliding window, BFS/DFS, dynamic programming, and backtracking appear repeatedly.


πŸš€ Final Thoughts

Preparing for technical interviews is a marathon, not a sprint. These 150 problems represent a carefully curated selection of the most important questions asked by top tech companies.

Remember that the goal isn't just to solve all 150 problemsβ€”it's to deeply understand the patterns, algorithms, and data structures they represent. Quality over quantity is key.

Stay consistent, be patient with yourself, and don't get discouraged by difficult problems. Every problem you solve makes you a better engineer and brings you one step closer to landing your dream job.

Good luck with your preparation! You've got this! πŸ’ͺ


πŸ“– Additional Resources

  • LeetCode Discuss: Read solutions and discussions from the community
  • NeetCode: Video explanations for popular problems
  • Algorithms Textbook: "Introduction to Algorithms" by CLRS
  • YouTube Channels: Abdul Bari, Back To Back SWE, Tech Dose
  • Practice Platforms: LeetCode, HackerRank, CodeSignal

Found this guide helpful? Follow me for more technical interview preparation content!

Have questions or suggestions? Drop a comment below!

Top comments (0)