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

205 questions

  1. 97If given two strings, each containing a number larger than 32-bit, how do you add them and return the result as a string?MediumCodingTechnical· Waymo
  2. 98Find all permutations of a given string.MediumCoding· Amazon
  3. 99You're trying to take a photograph of two teams arranged in rows. How would you order them so shorter players are in front and taller players are behind?EasyCodingTechnical· Anduril
  4. 100Calculate the average distance between cities.MediumCodingProduct· Waymo
  5. 101Find the first common ancestor of two nodes in a binary tree.MediumCoding· Meta
  6. 102How would you sort a bitonic array efficiently?MediumCoding· Oracle
  7. 103Given stock prices for the next n days, how can you maximize your profit by buying or selling one share per day?MediumCoding· Adobe, Apple
  8. 104Calculate the height of a binary tree.EasyCoding· Apple, Google
  9. 105Calculate the number of times a pattern appears in a string.HardCoding· LinkedIn
  10. 106Build a CalculatorMediumCoding· Adobe, Apple
  11. 107Determine if an array of integers from 1 to n contains a duplicate in constant time and space.MediumCoding· Adobe, Apple
  12. 108How would you implement a child-parent relation for finding the Least Common Ancestor (LCA) without using pointers?MediumCoding· Samsung
  13. 109Find the closest number in a sorted array.MediumCoding· DoorDash
  14. 110Given an array of points on a plane (x,y), write a function to return the distance between the closest pair of points.HardCoding· Visa
  15. 111Given an array of integers, return the pairs with the minimum absolute difference between them.MediumCoding· Microsoft
  16. 112Given an integer, reverse it. Integers are within range [-2^15, 2^15 - 1].MediumCoding· Microsoft
  17. 113Construct a binary tree from an ancestor matrix.MediumCodingTechnical· LinkedIn
  18. 114Construct a binary tree given its preorder and inorder traversals.MediumCoding· Adobe, Amazon
  19. 115Given a string, return the number of vowel substrings ('a', 'e', 'i', 'o', 'u') that include all five vowels.MediumCoding· Oracle
  20. 116Count the number of ways to split a string.EasyCoding· Google
  21. 117Degrees of FriendshipEasyCoding· Google
  22. 118Design a data structure that supports insert, delete, search, and retrieve in constant time.MediumCoding· Meta
  23. 119If you have a vector with many values, mostly zeroes, how would you design a data structure to represent it?MediumCodingTechnical· WWhatsApp
  24. 120Design LFU cache.MediumCodingSystem design· Microsoft