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

28 questions

  1. 1Koko eating bananas.MediumCoding· Flipkart, Amazon
  2. 2Merge IntervalsMediumCoding· Blinkit, Docquity Holdings(PBS)
  3. 3Top k frequent elementsMediumCoding· Amazon, Apple
  4. 4Product of Array Except SelfMediumCoding· PayPal, Target
  5. 5Course ScheduleMediumCoding· Zoho
  6. 6Given a list of items with different sizes, write an algorithm to pack these items into the minimum number of batches without exceeding the capacity of each batch.MediumCoding· Amazon
  7. 7Given the root of a binary tree, return the length of the diameter of the tree.MediumCoding· Amazon, Google
  8. 8Count items within compartments between specific indices of an array.MediumCoding· Amazon
  9. 9Implement file searchMediumCoding· Amazon
  10. 10Implement a phrase search in a list of documents.MediumCoding· Amazon, Confluent
  11. 11Find the maximum product of any two integers in an array.MediumCoding· Amazon
  12. 12How do you split a machine learning dataset for training, evaluation, and testing?MediumCoding· Amazon
  13. 13Get the top API users based on transaction logs.MediumCoding· Amazon
  14. 14Print the top view of nodes in a binary tree.MediumCoding· Amazon
  15. 15Find all permutations of a given string.MediumCoding· Amazon
  16. 16Construct a binary tree given its preorder and inorder traversals.MediumCoding· Adobe, Amazon
  17. 17Detect cycle in graphMediumCoding· Amazon
  18. 18How can you tell if a graph is not a tree?MediumCodingTechnical· Amazon
  19. 19Given a factory represented as a 2D grid with some cells blocked and some containing robots, determine if the robots can collectively reach all unblocked cells.MediumCoding· Amazon
  20. 20Given an array of points and a point P, find the k closest points to P.MediumCoding· Amazon, LinkedIn
  21. 21Given a list of Nodes, each with a unique string id and a list of subnodes it depends on, find the maximum depth of the dependencies.MediumCoding· Amazon
  22. 22Given a binary matrix with every row sorted, find the index of the row containing the most number of 1s.MediumCoding· Amazon
  23. 23Find the shortest path in a graph.MediumCodingTechnical· Amazon
  24. 24Find the longest common prefix given two integer arrays.MediumCoding· Amazon