Question library
Questions from real interviews. Drill any of them by voice in a couple of minutes, with an interviewer, a score and feedback.
Explain how a hash table works and why lookup in it is O(1) on average. What is a collision, and when does a hash table degrade?JuniorExplain how a heap works and how to use it to find the k largest elements. Why is a heap of size k better than a full sort?JuniorExplain how a variable-length sliding window works and how sliding window problems differ from prefix sum problems. When won't a sliding window work?JuniorExplain how backtracking works, using the example of generating all subsets, and what its complexity is.JuniorExplain how to find the order in which to run tasks that have dependencies (topological sort), and how to detect a cycle along the way.JuniorExplain how to reverse a linked list in place, and why a dummy head is used in linked list problems. What's the time and space complexity?JuniorExplain how you approach a problem with dynamic programming: how you choose the state, the transition and the base case. Show it on the climbing stairs problem or the house robber problem.JuniorExplain the difference between depth-first and breadth-first tree traversal: how each one is implemented, what their space complexity is, and in which problems you'd choose BFS.JuniorExplain the two-pointer technique: when does it apply, why does it give O(n) instead of O(n²), and what example would you use to show it in an interview?JuniorExplain what Big O notation is and how to estimate the complexity of an algorithm. Why is O(n log n) better than O(n²) in practice, and why don't we write constants inside the O?JuniorExplain what a monotonic stack is and how it helps find the next greater element for every number in O(n).JuniorExplain what binary search on the answer is, and how you can tell that a problem can be solved with binary search even when there's no sorted array in it.Junior