SSlothintechsloth.io·Apr 15, 2021 · 2 min readCrushing Tech Interviews with the Top K Elements PatternTo follow up from my previous post, let's dig more into some patterns that revolve around heaps! When you're given a question that revolves around keeping track of k elements, a good bet is to think about solving the problem with heaps. Lets say you'...00
SSlothintechsloth.io·Apr 14, 2021 · 4 min readCrushing Tech Interviews with the Two Heaps PatternIf we have a problem where we're interested in knowing the smallest in element in one part of a given set of elements and the biggest element in the other part, we can use the two heaps pattern. Lets work through this problem together: Implement a cl...01M
SSlothintechsloth.io·Apr 13, 2021 · 2 min readCrushing Tech Interviews with the Linked List Reversal PatternAh, a good old linked list problem. Some people love them, some people help them. Hopefully with this pattern, you'll love questions which ask you to reverse the links between a set of nodes of a linked list. It may sounds like a niche pattern but it...01B
SSlothintechsloth.io·Apr 12, 2021 · 2 min readCrushing Tech Interviews with the Cyclic Sort PatternThis pattern is useful when dealing with problems involving arrays containing numbers in a range. How would you solve the following problem? Given n distinct numbers from 0 to n. Find the missing number. Key words to pick out here: distinct, 0 to n ...00
SSlothintechsloth.io·Apr 11, 2021 · 2 min readCrushing Tech Interviews with the Merge Intervals PatternThis pattern is useful when dealing with interval questions. A lot of the questions will require us to merge overlapping intervals in a given list. First step to answering a question like this is to answer the following question: How many ways can tw...00