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

21 questions

  1. 1Top k frequent elementsMediumCoding· Amazon, Apple
  2. 2Group anagramsMediumCoding· Blinkit, MakeMyTrip
  3. 3Product of Array Except SelfMediumCoding· PayPal, Target
  4. 401 Matrix: find the nearest zero for every cellMediumCoding· Adobe, Oracle
  5. 5Given the root of a binary tree of integers, return the maximum path sum.MediumCoding· Adobe, Apple
  6. 6Print all combinations of numbers from 1 to n that sum to n.MediumCoding· Adobe, Apple
  7. 7Cycle Detection in Package Manager.MediumCoding· Adobe
  8. 8Explain how to find a target sum in an array.MediumCoding· Adobe, Google
  9. 9Find a triplet in an array with a given sum.MediumCoding· Adobe, Goldman Sachs
  10. 10Generate ParenthesesMediumCoding· Adobe, Google
  11. 11Given n houses in a line with money in each, find the maximum amount a robber can steal, without stealing from two adjacent houses.MediumCoding· Adobe, Apple
  12. 12PermutationsMediumCoding· Adobe, Apple
  13. 13Find the longest palindromic subsequence using dynamic programming.MediumCoding· Adobe, Apple
  14. 14Find the maximum subarray sum.MediumCoding· Adobe, Apple
  15. 15Given stock prices for the next n days, how can you maximize your profit by buying or selling one share per day?MediumCoding· Adobe, Apple
  16. 16Build a CalculatorMediumCoding· Adobe, Apple
  17. 17Determine if an array of integers from 1 to n contains a duplicate in constant time and space.MediumCoding· Adobe, Apple
  18. 18Construct a binary tree given its preorder and inorder traversals.MediumCoding· Adobe, Amazon
  19. 19Determine if a given binary tree is a binary search tree (BST).MediumCoding· Adobe, Google
  20. 20Given an nxn grid of 1s and 0s, return the number of islands in the input.MediumCoding· Adobe, Amazon
  21. 21Write a function to return all prime numbers up to a given number n.MediumCoding· Adobe, Apple