Medium Collection Top Interview Questions

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.

  1. 3Sum
  2. Set Matrix Zeroes
  3. Group Anagrams
  4. Longest Substring Without Repeating Characters
  5. Longest Palindromic Substring
  6. Increasing Triplet Subsequence
  7. 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.

  1. Add Two Numbers
  2. Odd Even Linked List
  3. 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.

  1. Binary Tree Inorder Traversal
  2. Binary Tree Zigzag Level Order Traversal
  3. Construct Binary Tree from Preorder and Inorder Traversal
  4. Populating Next Right Pointers in Each Node
  5. Kth Smallest Element in a BST
  6. Inorder Successor in BST
  7. 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.

  1. Letter Combinations of a Phone Number
  2. Generate Parentheses
  3. Permutations
  4. Subsets
  5. Word Search

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.

  1. Sort Colors
  2. Top K Frequent Elements  
  3. Kth Largest Element in an Array
  4. Find Peak Element  
  5. Search for a Range
  6. Merge Intervals 
  7. Search in Rotated Sorted Array 
  8. Meeting Rooms II  
  9. 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.

  1. Jump Game
  2. Unique Paths 
  3. Coin Change
  4. 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).

  1. Flatten 2D Vector  
  2. Serialize and Deserialize Binary Tree  
  3. Insert Delete GetRandom O(1)
  4. 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.

  1. Happy Number 
  2. Factorial Trailing Zeroes  
  3. Excel Sheet Column Number  
  4. Pow(x, n)  
  5. Sqrt(x) 
  6. Divide Two Integers  
  7. 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.

  1. Sum of Two Integers  
  2. Evaluate Reverse Polish Notation  
  3. Majority Element  
  4. Find the Celebrity  
  5. Task Scheduler

Leave a Reply

Your email address will not be published.