Ctrl K

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?TheoryJuniorExplain 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?TheoryJuniorExplain how a variable-length sliding window works and how sliding window problems differ from prefix sum problems. When won't a sliding window work?TheoryJuniorExplain how backtracking works, using the example of generating all subsets, and what its complexity is.TheoryJuniorExplain how to find the order in which to run tasks that have dependencies (topological sort), and how to detect a cycle along the way.TheoryJuniorExplain 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?TheoryJuniorExplain 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.TheoryJuniorExplain 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.TheoryJuniorExplain 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?TheoryJuniorExplain 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?TheoryJuniorExplain what a monotonic stack is and how it helps find the next greater element for every number in O(n).TheoryJuniorExplain 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.TheoryJunior