I’ve solved a lot of leak code problems. Hey guys, I’m still unemployed, so let’s solve another leak code problem.
And eventually got an offer from Google, where I’ve interviewed over a dozen candidates. After hundreds of hours of grinding and explaining problems, I learned there are different levels of preparation. And I’ll share everything I know about the process, including how to practice, how many problems you should solve, common mistakes to avoid, and whether I think leak code is a total waste of time.
Like most people I started with easy questions, I used C++ because it was the first language I learned, but this was a bit of a mistake and unfortunately I didn’t learn so until later on. Initially I wasn’t even able to solve the easy problems. Even if I knew the solution, I would always get tripped up by edge cases. I wasn’t an expert in data structures and algorithms. I mainly knew the basics like arrays, linked lists, hash maps, trees, sorting, and binary search.
And honestly, I think that’s pretty much enough before you actually start solving problems. Because a lot of the easy problems will solidify your understanding of the basics. And 50 problems later, that’s where I was. I could solve a lot of the trivial problems like reversing a string or inverting a binary tree, but I hadn’t even touched a graph problem and I didn’t even know what dynamic programming was.
But believe it or not, 50 problems was enough for me to get an internship at a bank. But I knew I had to keep grinding if I wanted to get a job at a big tech company. So I continued to solve problems in a random order, which was another mistake. But probably 60 or 70 questions and I switched to Python. I would always look at the leak code discuss section and I saw that Python code was always the shortest and most concise. Even though I had never used Python before and still to this date, I’ve never used Python at any job or internship. It was an easy choice to make because you don’t have to learn the entire language.
You really just have to learn the basic syntax, how to write if statements, for loops, and all the standard data structures and methods. And you can actually learn these as you solve leak code problems just by googling as needed. Now C++ isn’t a bad choice either, but I would definitely avoid a verbose language like Java. The language probably won’t be a deal breaker, but it can definitely save you a few minutes when you’re typing out your code, which can definitely make a difference in a real interview. But it doesn’t matter how fast you type if you can’t actually solve the problem. And even after solving 100 problems, while I had learned all the high value algorithms like DFS, BFS, sliding window, and backtracking, I wasn’t able to consistently solve a new problem for the first time.
I didn’t know it then, but the reason was that a lot of leak code questions are sequential. You’ve probably seen questions like House robber one, House robber two, and House robber three. Obviously you should solve these questions in order, but actually most of leak code questions should be solved in a specific order. For example, you should never try solving dynamic programming problems unless you already have a solid understanding of backtracking. And you probably shouldn’t try solving graph problems until you have a solid understanding of trees. This is obvious in hindsight, but I’m sure a lot of people make this mistake, which is why I created a roadmap so that you don’t make the same mistake I did. It turns out that the order you solve problems in does matter.
I also think that solving one or two problems a day consistently is a lot better than cramming, because the ideas will actually stick.I realized that if I couldn’t solve a question in 45 to 60 minutes, I wasn’t going to be able to solve it myself. Previously, I would literally bang my head against the wall for three to four hours on a single problem, because I thought that was the only way to learn. But let’s just be honest, most of us are not going to be able to come up with some of these complex academic algorithms by ourselves. And even if you can come up with Floyd’s tortoise and hair algorithm, it’s probably not an efficient use of your time. There’s no shame in looking at a solution as long as you can understand exactly why it works. That’s why in my videos, I really try to explain my thought process behind every problem. This ended up saving me a lot of time, because I would get to a really hard problem, a crackhead problem I like to call them, like burst balloons, and I would get pretty close to solving the problem.
I would know it’s a dynamic programming problem, but I just couldn’t figure out the trick behind it. Then I would look at a solution, and only after five minutes of reading, I would realize, oh, that’s the trick. And then I would be able to immediately solve the problem. I was able to go from 100 to 250 solved questions a lot faster than I was able to solve my first 100 questions. And by then I had learned 99% of the patterns that I needed, even some of the complex ones. And I got to the point that writing out these algorithms like DFS, BFS, and binary search was as easy for me as writing a for loop, even some advanced ones like Union Find, Dijkstra’s, I could write out in less than five minutes. And that’s when I realized that most leak code problems fall into these buckets. For medium questions, you just need to figure out what algorithm you need and then apply it. Hard questions are similar, except there’s usually a really complex trick behind them.
And sometimes unless you’ve seen it before, only God can help you figure it out. Or maybe your interviewer if they happen to be generous. At this point, I was confident I could pass interviews, but I wasn’t 100% sure if I was ready for the big tech interviews like Google or Facebook. And spoiler alert, you will probably never feel 100% prepared. It’s not a binary decision whether you are ready for an interview or not, because you never know which questions you’re going to be asked. It’s more of a distribution. You might have a 50% chance of passing or you might get to the point where you have a 90% chance of passing. If you’re a perfectionist, I’m sure you want 100% chance. But that’s almost never going to be the case. I think a good rule of thumb is that you should be able to solve a medium problem that you’ve never seen before in 20 to 25 minutes. If you can do that, you probably have at least an 80% chance of passing most Fang interviews.
I continue to solve up to 569 problems, even though I had already gotten into Google, mostly because I’m a loser. But it’s not quite as time consuming as you might think, because I’ve gotten to the point that I can solve most medium questions in 10 to 15 minutes. But I definitely don’t recommend it because there are diminishing returns on solving more and more problems. I think quality is much better than quantity.
I recommend solving about 150 questions like the neat code 150 list, which has video solutions and code solutions in 14 languages. But make sure you really understand each and every problem. A huge mistake that most people make is that they don’t go back and review previous problems. For these complex algorithms to really sink in, you need repetition. That’s why I’m working on taking each problem from the neat code 150 list and converting it into a multiple choice quiz. Because it’s really hard to go back and re solve each question. And usually all you need to do is review the trick. So I made quizzes that you should be able to solve in a few minutes, but also get a lot of value from it. You can check out a handful of problems right now. But when the list is complete, ideally you should be able to go through it in just a single day.
I think this will be a huge time saver for people. So after all that is leak code just a big waste of time. Yes, if you’re trying to learn about development and actually building applications, leak code probably isn’t going to help you do that. But people will spend thousands of hours getting a CS degree to get a decent paying job, but won’t spend an extra 100 hours to get a big compensation bump. It doesn’t really make sense to me. Don’t get me wrong, leak code isn’t the most exciting thing in the world. But I do think it helps you think about edge cases and how you would unit test your code. These are skills that can be applied to application development. And believe it or not, algorithms and data structures are widely used in industry from database engines to compilers. But it’s true that leak code won’t teach you everything.
That’s where Taro comes in. It’s a YC backed platform to help you grow in your tech career, including helping you onboard as quickly as possible and get you a faster promotion using master classes with experience tech leads and leaders.
If you enjoyed this blog and want to help it reach a broader audience, please click the like button. We’d also love to hear your thoughts on these AI tools from Google. So feel free to share your opinions in the comment section.
If you want more blogs like this, please click here.
Thanks.