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

164 questions

  1. 145Print the top view of nodes in a binary tree.MediumCoding· Amazon
  2. 146Calculate the trapped rainwater between bars in a given array.HardCoding· Adobe, Amazon
  3. 147Find all permutations of a given string.MediumCoding· Amazon
  4. 148Construct a binary tree given its preorder and inorder traversals.MediumCoding· Adobe, Amazon
  5. 149Build an image carousel that displays a sequence of images (using React.js or vanilla JS).MediumCoding· Amazon
  6. 150Detect cycle in graphMediumCoding· Amazon
  7. 151How can you tell if a graph is not a tree?MediumCodingTechnical· Amazon
  8. 152Edit distanceHardCoding· Adobe, Amazon
  9. 153Given 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
  10. 154Given an array of points and a point P, find the k closest points to P.MediumCoding· Amazon, LinkedIn
  11. 155Given 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
  12. 156Find the palindromes.EasyCoding· Amazon, Apple
  13. 157Given a binary matrix with every row sorted, find the index of the row containing the most number of 1s.MediumCoding· Amazon
  14. 158Find the shortest path in a graph.MediumCodingTechnical· Amazon
  15. 159Given an array, find the two sum.EasyCoding· Adobe, Amazon
  16. 160Find the longest common prefix given two integer arrays.MediumCoding· Amazon
  17. 161Print the maximum positive sequence in a given array.MediumCoding· Amazon
  18. 162Implement inorder traversal for an N-ary tree.MediumCoding· Amazon
  19. 163Given an array, print the Next Greater Element (NGE) for each element. The NGE for an element x is the first greater element on the right side of x in the array, or -1 if none exists.MediumCoding· Amazon
  20. 164Given an nxn grid of 1s and 0s, return the number of islands in the input.MediumCoding· Adobe, Amazon