Backtracking is an effective technique for solving algorithmic problems. In backtracking, we search depth-first for solutions, backtracking to the last valid path as soon as we hit a dead end.
- Jan 18, 2018...more
- Jan 2, 2018...more
Let’s solve an interesting programming interview problem: how to find an arbitrage. Here’s the question.
Suppose you are given a table of currency exchange rates, represented as a 2D array. Determine whether there is a possible arbitrage: that is, whether there is some sequence of trades you can make, starting with some amount A of any currency, so that you can end up with some amount greater than A of that currency.
- Dec 19, 2017...more
Let’s work through the following problem.
There exists a staircase with N steps, and you can climb up either 1 or 2 steps at a time.
Given N, write a function that returns the number of unique ways you can climb the staircase.
The order of the steps matters.
- Dec 7, 2017...more
This post is targeted for people looking to get offers from large tech companies like Google, Facebook, Microsoft, Dropbox, Uber, Lyft, and Airbnb. This isn’t to say other companies aren’t interesting! It’s just that these companies’ interview processes are all straightforward (though not necessarily easy) and many people are interested in working for them.
- Nov 30, 2017...more
Let’s work through the problem of uniformly picking a random element from a gigantic stream. This is a common interview question at companies like Google and Facebook.
- Nov 21, 2017...more
Let’s go over the thought process for solving a tricky coding interview question. I often find it’s not enough to just be able to solve the question; you really need to vocalize your thought process. This shows that you’re a strong communicator and that you didn’t just get lucky solving this one problem.