Question bank

4,310 interview questions, answered.

Reference answers, what the interviewer is really testing, how it is graded, and the follow-ups that come next.

Easy 190Medium 2,498Hard 982
Filters · onDifficulty, topic, company

94 questions

  1. 49Write a function to balance parentheses in a given string by removing the fewest characters possible. Ensure that each opening parenthesis has a corresponding closing parenthesis and each pair is properly nested.MediumCoding· Meta
  2. 50Given a string with parentheses, write a function that removes the minimum number of characters to balance the parentheses.MediumCoding· Meta
  3. 51Given a binary tree, check if each node is the average of all descendantsMediumCoding· Meta
  4. 52Given the root of a binary tree, return the length of the diameter of the tree.MediumCoding· Amazon, Google
  5. 53Write a function that takes an array of integers and checks for duplicate values in any contiguous window of size N.MediumCoding· Meta
  6. 54Given a collection of rooms where Alibada is in one and moves one room a day to an adjacent room, write a program to determine if you can find Alibada with the given list of rooms.MediumCoding· Meta
  7. 55Given an array of integers and an integer k, find the kth largest element in the array.MediumCoding· Meta, Microsoft
  8. 56Find a local minima in an array Last UpdatedMediumCoding· Meta
  9. 57Find the equilibrium index in an array where sum of elements to the left is equal to sum of elements to the right.MediumCoding· Meta
  10. 58Given a list of strings, find all strings that encode to the same value using a Caesar Cipher. (A Caesar Cipher rotates characters, e.g. in CC3: a->d, b->e, ..., z->c)MediumCoding· Meta, Pinterest
  11. 59Explain how to find a target sum in an array.MediumCoding· Adobe, Google
  12. 60Given an array of numbers where every number occurs twice except one, how would you find the unique number in O(log n) time?MediumCoding· Meta
  13. 61Generate ParenthesesMediumCoding· Adobe, Google
  14. 62Implement a circular buffer.MediumCoding· Meta
  15. 63Implement the memcpy() function in C.MediumCoding· Meta
  16. 64Implement TrieMediumCoding· Apple, Goldman Sachs
  17. 65Find the largest perimeter of an island given a two-dimensional array of 1's and 0's representing land and water.MediumCoding· Bloomberg, Meta
  18. 66Find the lowest common ancestor (LCA) of two nodes in a binary tree.MediumCoding· Apple, LinkedIn
  19. 67Implement LRU Cache.HardCoding· Accenture, Adobe
  20. 68Merge k sorted linked lists.HardCoding· Adobe, Apple
  21. 69Move all zeros to the end of an array.EasyCoding· Adobe, Amazon
  22. 70Partition an array into two sub-arrays with equal sum.MediumCoding· Apple, LinkedIn
  23. 71Squares of sorted arrayMediumCoding· Meta, PayPal
  24. 72Calculate the trapped rainwater between bars in a given array.HardCoding· Adobe, Amazon