just improve your problem solving skills and you'll be able to pass all your coding interviews just solve some linkless questions over here and some tree questions over there and then you'll be able to derive the edit distance algorithm yourself just like this Soviet mathematician did in the 1960s if that sounds ridiculous to you it's because it is let me tell you a little secret you're not supposed to figure it out yourself did you ever watch that episode of Naruto where the exam is intentionally designed to be so difficult that the only way to pass is
to cheat well that's the modern coding interview in a nutshell let me tell you what I mean we all learned long multiplication as kids we all memorized this algorithm to get the product of these two numbers First We Take 2 * 5 that's 10 the one is carried then we do 2 * 5 over here that's 10 again we remember we carried the one so it's actually 11 we start all over with the three on the second row but before we have the zero over here and then we say 3 * 5 that's 15 then
we say 3 * 5 once again that's 15 so this becomes 16 take these two add them together we get 1760 now I know what you're thinking this is just math how is it relevant to leak code but please just hear me out most people don't care enough to ask why does this work they don't care enough to notice that this is the same as writing it out like this but this is a hard problem so let's make it easier this is really just 5 + 50 this is really just 2 + 30 expanding it
out taking two times this part we get this taking 30 times this part we get this and this part over here you can notice is going to be 10 + 100 this part over here I'm actually going to rewrite it I'm going to make it even more simple why not 30 that's too big I'd rather have 10 * 3 and then multiply that by 5 + 50 so now just focusing on this part over here this is going to be equal to 15 + 150 and so this becomes 110 which look it looks pretty familiar
over here this becomes 165 which looks to me like we had that over here and now it becomes clear why we add a zero over here doesn't it it becomes pretty clear cuz we just take the 10 out of the 30 over here this isn't really three times these numbers we just took a shortcut to make it simple for us and then at the end We'll add that 10 so just like now I'm going to add 10 I'm going to add a zero here this is 1650 and now this is just addition I took multiplication
and and turned it into an addition problem this is called problem solving and now that I've gone through this I have at least a chance of discovering long division on my own have you noticed that some people are naturally better at leak code or just learn faster than others well usually those people come from another highly technical background like math and they probably already built a lot problem solving skills that can be applied to computer science it makes sense why a mathematician would have an advantage over say a farmer for example so what can you
do to give yourself an advantage don't focus on extremes if you try to memorize solutions for every single problem which is not easy by the way you'll never be able to solve a new problem if you never look at the solution solution for a problem you'll spend 10 hours on a single problem and still won't be able to figure it out in my opinion there is an intersection between memorizing and problem solving you need a little bit of both if you're going to memorize anything please please memorize the DFS algorithm it's the single most important
algorithm in coding interviews memorize the core CS algorithms like binary search the sliding window technique and when you get super familiar with these core skills you realize that most leak code problems are just about identifying which core algorithm to use and then applying it to the specific problem in other words in terms of coding interviews problem solving is all about pattern recognition a reasonable approach to interviews would be to First learn the core algorithms needed it's fine to look at Solutions you're in the learning phase just like an ml model you're taking in training data
after that you should try to apply your knowledge if you were able to derive the solution to all these problems by yourself it would greatly improve your problem solving skills but that's obviously not realistic but consider this if you're trying to figure out the edit distance algorithm you would have a much better chance of doing so if you first solved the longest common subsequence problem because it has significant overlap and of course that's not something you realize until you've actually solved these problems which is kind of why I've organized them in this list you don't
have to have already solved the problems to make that connection by the way this is n code. there's a ton of free resources on it so check it out if you want to support me and gain access to an Ever growing amount of content you can do so by getting a pro membership thanks for watching and I'll see you soon