Total 51 questions.
Array and Strings
Array and String type of questions were asked in interviews frequently. You will most likely encounter one during your interviews.
LeetCode recommends: Group Anagrams, Longest Substring Without Repeating Characters, Longest Palindromic Substring and Missing Ranges.
- 3Sum
- Set Matrix Zeroes
- Group Anagrams
- Longest Substring Without Repeating Characters
- Longest Palindromic Substring
- Increasing Triplet Subsequence
- Missing Ranges
Linked List
Linked List problems are relatively easy to master. Do not forget the Two-pointer technique, which not only applicable to Array problems but also Linked List problems as well.
Another technique to greatly simplify coding in linked list problems is the dummy node trick.
LeetCode recommends: Add Two Numbers and Intersection of Two Linked Lists.
Trees and Graphs
Tree is a special type of graphs, so the two usual techniques used to traverse a graph are also applicable to trees.
We recommend: Binary Tree Inorder Traversal, Populating Next Right Pointers in Each Node and Number of Islands.
Note that some of the tree problems can also be asked in n-ary tree format, so make sure you know what an n-ary tree is.
Note: Although Number of Islands is not a tree problem, it can be represented as a graph and therefore LeetCode categorize it as a graph problem.
- Binary Tree Inorder Traversal
- Binary Tree Zigzag Level Order Traversal
- Construct Binary Tree from Preorder and Inorder Traversal
- Populating Next Right Pointers in Each Node
- Kth Smallest Element in a BST
- Inorder Successor in BST
- Number of Islands
Backtracking
Here are some of the best backtracking interview questions.
Letter Combinations of a Phone Number and Generate Parentheses are both great interview questions. Also make sure you are able to write code to generate permutations / subsets (combinations), those are great backtracking exercises too.
Sorting and Searching
These problems deal with sorting or searching in a sorted structure.
LeetCode recommend: Sort Colors, Search for a Range, Merge Intervals, Search in Rotated Sorted Array, Meeting Rooms II and Search a 2D Matrix II.
- Sort Colors
- Top K Frequent Elements
- Kth Largest Element in an Array
- Find Peak Element
- Search for a Range
- Merge Intervals
- Search in Rotated Sorted Array
- Meeting Rooms II
- Search a 2D Matrix II
Dynamic Programming
Here are some classic Dynamic Programming interview questions.
LeetCode recommends: Unique Paths, Coin Change and Longest Increasing Subsequence.
Design
These problems may require you to implement a given interface of a class, and may involve using one or more data structures. These are great exercises to improve your data structure skills.
LeetCode recommends: Serialize and Deserialize Binary Tree and Insert Delete GetRandom O(1).
- Flatten 2D Vector
- Serialize and Deserialize Binary Tree
- Insert Delete GetRandom O(1)
- Design Tic-Tac-Toe
Math
Most of the math questions asked in interviews do not require math knowledge beyond middle school level.
LeetCode recommends: Excel Sheet Column Number, Pow(x, n) and Divide Two Integers.
- Happy Number
- Factorial Trailing Zeroes
- Excel Sheet Column Number
- Pow(x, n)
- Sqrt(x)
- Divide Two Integers
- Fraction to Recurring Decimal
Others
Here are some other questions that do not fit in other categories.
LeetCode recommends: Majority Element, Find the Celebrity and Task Scheduler.
- Sum of Two Integers
- Evaluate Reverse Polish Notation
- Majority Element
- Find the Celebrity
- Task Scheduler