 What's up guys, Mike, the coder here and today I'm going to go over just an idea that question that someone asked me that should you memorize lead code solutions? And from my point of view, so I was redoing a ton of lead code problems here. And I was actually writing down like every single idea from lead code, whenever I try to solve something and I've write down the algorithm and how it's solved. And from my point of view, you should not be memorizing code. Okay. So there were some problems where I was just like, I really didn't know how to do it. So like, in this case, triangle valid triangle number, right? valid triangle number was given an array, you had to return the number of triplets that could make the insides of a triangle, right? So it was like, the solution was that you had to use two pointers, but then you're going to have a third for loop while loop, while it's going through. And that's the one that you subtract and add by to count the number of triplets that there are, right? You the third pointer is the one that increments, but that affects a second loop or something. So that specific that thing, I tried memorizing the code, and then I tried putting it into the solution and submitting it. And I could just never get the right answer because I don't know, it was something like K plus plus or something or K minus minus or something, some iteration where like nums I is not equal to zero or something, something like that. So in my point of view, should you memorize code? I don't think so. Memorizing code has no bearing whatsoever. First of all, it is very hard to memorize the syntax of every single problem and every single solution that you do. And I don't think you'll be able to be able to solve a new problem if you just memorize the solution like that. But here's what I take is that you should memorize the pattern that is given to you. So like, let's say here, 1525, right? The pattern is that you create a prefix and suffix array of the number of different characters. And you loop to see if the first and the second characters are the same, right? So that is a pattern that you can memorize. And if you've given another problem, you might have to be able to create a prefix and suffix array and check if the adjacent characters are the same, right? So that's something you can memorize, right? Because that's not a hard thing to do. It's like, Okay, just give a prefix value, create a suffix array, check if the first and second character are the same from the prefix and suffix array, right? Or like, in this case of here, create an adjacency matrix, then run Dexter's algorithm on the source K, then get the maximum distance from all the minimum values, right? So that's something that you could remember how to do like, be able to remember, hey, I could create an adjacency list and then run Dexter's algorithm, right? So that is something you could remember, right? So if I'm given a new problem, I could be able to, in my tool belt, I could say, Hey, maybe I need to create an adjacency list and run Dexter's algorithm, right? But if I try to memorize how to like the specific certain syntax of getting the maximum distance all the time, I'm not going to be able to remember that well, right? If I remember the for loop and i equals zero i plus one and so on and so forth, that's not going to be able to help me in an interview, right? So what the better idea is to memorize the pattern, right? Memorize a certain pattern and the certain idea and then be able to apply it into the code. Okay, so if you add to be able to do this, I'd say you had to run Dexter's algorithm, right? You should memorize how the Dexter's algorithm works in that just like the pseudocode. Hey, this is what it does. It creates an array, uses like stores all the previous distances from the current source node, and if it's less than the current value, it updates it or something like, right? Something like that. Like that's something that you can remember easily, right? Whereas if you try to memorize the for loop and the while loop and all this other stuff, that's not going to help you. Okay, that's just going to make it much, much more difficult. And yeah, you're not going to be able to remember it. But that's just the quick video of what I think of should you memorize source code or not. Let me know in the comments section down below what you think. I haven't been uploading in a long time, but I'm getting back right into it. It's because my whole laptop just like got broken and all this other stuff. But now that I am able to upload again, I'm going to be uploading daily. So yeah, the next video we're going to upload is the coding interview challenge and more patterns. So those patterns you could memorize, but don't try to memorize code. Okay, so I hope you guys enjoyed this video. Rate, comment, subscribe. I'll check you guys later. Peace.