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

343 questions

  1. 217Calculate the average distance between cities.MediumCodingProduct· Waymo
  2. 218Find the first common ancestor of two nodes in a binary tree.MediumCoding· Meta
  3. 219How would you sort a bitonic array efficiently?MediumCoding· Oracle
  4. 220Given a bookstore database schema, write SQL queries using joins and aggregations to answer questions about sales, inventory, and customer data.MediumCodingData· Meta
  5. 221Given stock prices for the next n days, how can you maximize your profit by buying or selling one share per day?MediumCoding· Adobe, Apple
  6. 222Calculate Test ScoresMediumCodingData· Google
  7. 223Build a CalculatorMediumCoding· Adobe, Apple
  8. 224Determine if an array of integers from 1 to n contains a duplicate in constant time and space.MediumCoding· Adobe, Apple
  9. 225Find the closest number in a sorted array.MediumCoding· DoorDash
  10. 226Given an array of integers, return the pairs with the minimum absolute difference between them.MediumCoding· Microsoft
  11. 227Given an integer, reverse it. Integers are within range [-2^15, 2^15 - 1].MediumCoding· Microsoft
  12. 228Coin ChangeMediumCodingTechnical· Apple, Citi
  13. 229Construct a binary tree from an ancestor matrix.MediumCodingTechnical· LinkedIn
  14. 230Construct a binary tree given its preorder and inorder traversals.MediumCoding· Adobe, Amazon
  15. 231Given a list of words, find the number of prefix pairs, i.e. pairs i, j where words[i] == words[j] or words[i].startswith(words[j]) or words[j].startswith(words[i]).MediumCoding· Capital One
  16. 232Find the number of users who called three or more people in the last week.MediumCodingData· Meta
  17. 233Given a string, return the number of vowel substrings ('a', 'e', 'i', 'o', 'u') that include all five vowels.MediumCoding· Oracle
  18. 234Custom Sort StringMediumCoding· Meta
  19. 235Implement a decode and encode function of a general N-ary tree.MediumCoding· Google
  20. 236Build an image carousel that displays a sequence of images (using React.js or vanilla JS).MediumCoding· Amazon
  21. 237Design a data structure that supports insert, delete, search, and retrieve in constant time.MediumCoding· Meta
  22. 238If you have a vector with many values, mostly zeroes, how would you design a data structure to represent it?MediumCodingTechnical· WWhatsApp
  23. 239Design and implement a ranked cache system.MediumCodingSystem design· LinkedIn
  24. 240Design LFU cache.MediumCodingSystem design· Microsoft