Damn I almost forgot I even had this channel. 🌍 The Roadmap: neetcode.io/roadmap ✏ The practice page: neetcode.io/practice 🚀 My second YT channel: youtube.com/@NeetCodeIO 🔥 Pro neetcode.io/pro
It is right in the beginning. According to google, episode 24. Since it's not that much, I'd recommend watch from the 1st episode. It is really fun!@@agamersdiary1622
Thanks a lot for your effort. I looked at your blind75 solutions and coded them along the way, I even used the debugger sometimes. After 2 weeks (left time to ensure I dont write off of memory), I tried to solve the problem on my own. If I could figure out the patterns, it was a matter of 10 mins to code. Sure I had some edge case issues but now I am in much better shape. Your videos explain the logic very well. I used to feel very bad when I was doing this for the first time and couldnt see the solution right away. But as you said, this is the learning phase. After finishing the 75 problems for the 2nd time I was able to solve others by applying the patterns. And got confidence along the way. I am not interested in joining faangs, I study for my own knowledge and to become a better interviewer. A tip for folks: the best time to prepare is when you are not looking for a job.
I still can't solve easy solutions without looking at solutions. But with anything if you do not enjoy or at least show up to it almost everyday try to find something where you can When I was training BJJ it was 4-5 times a week (some days were rough) but you still show up@@krox477
Ironically, the majority of programmers can't solve those problems off the top of their head in the 15 - 45 minute time window under extreme pressure. Coding questions are fundamentally broken. You end up with people who memorize the top questions but have no idea about calculating time complexity or system architecture. They end up turning an API into 10 microservices even though their system only has to support 1000 users per hour.
Now with serverless, those 10 microsservices became 100 nanosservices to "minimize costs" and there's unreadable, unmaintainable scripts all over the place taping everything together
Idiot admires complexity, genius appreciates simplicity. I once worked with a tech pro and he got upset because he didn't get the chance to smash perfectly fine system that were making money to pieces and rebuild how he wanted it to be. 😂
Thanks for putting some light on this. I'm working on turning my coding hobby into a career change, and I love trying to solve difficult problems (LC or otherwise) on my own. Sometimes I need a little reminder that my goal is learning, not just rediscovering the wheel. Gotta stay balanced.
This is 100% true, at least in my life. My final exam for Data Structures and Algorithms I failed 2 coding problems, professor asked to hand write pseudo code, I tried, but it was a mess whether this was due to nervousness, or just not believing in myself, I honestly can't say. We were taking the exam 1 on 1 via Zoom call (this is 2020, covid). He took a long look at my solutions and plainly asked me how would I solve it, in plain english, so I told him, and he walked me through writing that out in a pseudo way. I knew how to solve it, I just needed him to ask me questions. So, TLDR, never doubt yourself, and IMO always learn how to solve a problem, intimately, no matter what. Even if it's simple, it's all building blocks and it continues for the rest of your life. Super long comment, but Thank you Neet, you've made a big difference in my life!
Damn i have my data structures and algo final exam this afternoon and i've just been studying for it by practicing enough problems so that i will have technically "seen" any type of problem that appear on the exam (this is how i've done well in every single exam my life).
NeetCode is probably one of the best resources for technical interview preparation. I just got accepted to a Google Software Engineering Internship that starts this June, and I wouldn't have made it without your help. I owe you a huge one, brother. Cheers, Tom
Do you have any advice? I have a OA due Monday, but I mainly use SQL in my current role. It's not an option, so I'm trying to pivot to Python,. It's been difficult learning so far, but I really want to do well. I figure they must have liked my background if i passed the screening and received the OA. But I really want to perform well. Life changing opportunity.
@@TDMac11 My OA was two leetcode style questions, and I was lucky enough to receive two that were not too hard. My assumption is that they are randomized from a dedicated set of questions with varying difficulty. At this point they are checking mostly for correctness and not for efficiency. For one of the questions I submitted a suboptimal solution in O(n) even though there existed an O(1) solution, but it was correct so it passed. So one advice would be maybe don't jump over your head trying to over-optimize your solution. Write something that works, and then test the hell out of it with as many cases as you can think of. You may, of course, try to optimize your solution if you think there is room for that, but it might be a good idea to have something suboptimal as a backup. Note that on the technical interview stages you will be evaluated by your ability to optimize your solutions so this tip is only for the OA. For preparation I used the Neetcode roadmap and I think it was really good. If you have a lot of free then it might be a good idea to try to complete the entire thing (might take a while but totally worth it). If your free time is limited then I'd try to do 1-2 easy and 1-2 medium questions from as many topics in the roadmap as possible, preferably in the order they appear in the roadmap. If you have very little time then maybe focus on topics you find more challenging or are less familiar with. Important note - hard questions are not worth the time at this point. Good luck my friend!
Interviewing in tech has become a job in itself. And for live coding interviews you need to have memorized syntax and problem patterns so well that you have to make it look like you are seeing the problem for first time and act as if you are coming up with a solution on the spot. If you answer quickly then too bad 😆. Tech is mainstream now so whatever rules few prominent companies set the rest blindly follow. 10 years back, one would have attended different formats at diff companies a whiteboard interview at 1 company, a phone coding interview at another and in-person coding at some others.
I don't think it's necessarily true that you have to act like you're seeing it for the first time. Even in interviews I've conducted or I've seen other people conduct, nobody is taken by surprise if you are familiar with an optimal solution. The important bit is to be able to write correct and clearly understandable code. If you prematurely write an optimized algorithm whose solution you're not comfortable with, you're likely going to bomb the interview.
I don't think this is the correct way to think about this. You don't need to memorize the syntax and pretend you are seeing it on the stop. I'm and interviwer and have completed something like 200 interviews in my career. The biggest thing we are looking for is your thought process. Do you understand the problem deeply? Can you have a conversation about it? Are you stumbling around basic coding skills like writing a for loop... or does it come naturally to you? Does this person overcomplicate things to try to impress me?
If you solve the question too fast, the interviewer will come with another one. The goal is to keep you talking (pretty much as a hostage negotiation 🤔), not check if you solve the problem or not
reg the 101's of interviews and its purpose that few comments brought up - I get the basics and expectations of interviews since i have been a interviewer too. Some further thoughts 1. In a live interview, anyone who hasn't heavily practiced leetcoding will go though a process of assumptions and errors to come to a correct solution. without knowing the pattern, i'm not sure if a leetcode medium-hard can be written with a minimum complexity nlogn solution in 30-45 mins. 2. Most interviewers are too rigid and some even go on to infer negatively if you refer syntax ( ** syntax here doesn't necessarily mean how to write a for loop or looking up basic ds functions) - language specific details like default behaviour of an in-built methods or methods/arguments. If you have to remember such details on top of your head then it means as a developer you are not allocating enough space for higher complicated problems. Interviews are all about testing your understanding of cs concepts and not about how fast you can recollect some details that you can easily look up or learn with some effort.
Not to mention calculating risks through various variables that are present like the weather and possible diseases. A farmer is a little bit of "know-it-all" kind of profession.
@@Ebani Farming was easier in terms of expectations. You were just expected to diligently work your field and not be lazy about it. Modern day, you're expected to use modern techniques and approach the problem of farming with some degree of scientific and engineering discipline. You can still make a miscalculation in either environment and turn out a poor harvest. The difference is that in the past nearly every other farmer wasn't doing any better so you were still generally competitive, while today, you'd go bankrupt.
2 points you might be missing: while it is true that farming isn't easy(it actually is pretty hard), the barrier to entry to farming is a lot lower than it is for mathematics. How long do you think it will take for someone and what percentage of the population do you think will be somewhat productive as a farmer? I would say the vast majority of people will probably be somewhat competent in farming in a couple of years. Contrast that with mathematics, to be able to actually do anything useful with it, you need to study it from elementary school to high school (and that's being generous). Even then, the vast majority of people just end up "not getting it". Secondly, I think you're underestimating how hard it is to do something so abstract like math. Have you ever seen the meme of some dude having difficulty doing fractions, but as soon as it's related to something like pizza and beer, it suddenly gets a lot easier? That's the same thing with farming and math. Farming is a very concrete task. You know what you want to do, you can see what you want to do, you can see it as you're doing it. Math is way more abstract. There isn't a way to check what you're doing is right unless you have a teacher or a calculator with you. And that's only arithmetic. I'm an engineer and the amount of engineers that get by without using math is astonishing to me. I'm one of the lucky few in my workplace that actually "gets it" and actually do end up using math for tasks. It's a surprisingly rare skill even amongst the "intelligent".
I always thought people invented the algorithms to solve these problems on the fly before I learned that they were just applying what they had memorized and practiced many times before. The same is applicable for things like math olympiads, too.
@@NihongoWakannaiNo, it's intelligent people not "smart people" who made those algorithms. Smart people used intelligent people algorithms to make money like Jeff Bezos who made Amazon. He studied computer science and he used his knowledge from school to make a book e-commerce website from using intelligent people program languages like html css js and ruby. Naruto is a good example describing smart people. If you take Naruto vs Neji. It was about Intelligent vs smart. Neji was the a spoil intelligent kid who parents brainwashed him to think he was superior and smarter than anyone else because his parents was feeding him lessons and knowledge. Naruto grow up thriving into a world with no parents. But Naruto showed him his place where intelligent people aren't like smart people. Smart people find shortcuts to beat intelligent people.
@@sukapow Gotta give credit to the inventors though. Most of us don't wanna be the ones figuring out how algorithms are designed and proven to work, we just wanna use the tools to create whatever software that we want. It took these geniuses hundreds and thousands of hours of heavy thinking so that we can learn it within an hour or 2. So no one's "beating" each other, and I don't like how its gotta be a competition when the fact is, we wouldn't know about these things if it weren't for the intelligent.
I made a mistake and started cramming for two weeks when i was given a coding assessment by Amazon. Needless to say, it was a dumpster fire. As a senior engineer, it hurt my ego, but reinforced just how technical and isolated this area of prep is. I need to take the proactive approach, studying a little each day for months.
Unfortunately, when I solve the next 10 problems, I forget the details of how I solved the previous 10. Yes, I remember what there was a pattern, but the problem is that each pattern often has several modifications, those very details that I forget and cannot reproduce again two weeks later. I also noticed that if a solution is unintuitive for me, then even having analyzed and understood the solution, for my thinking it still remains unintuitive due to which neural links do not appear and my internal garbage collector removes it from memory ))
This is why I prefer to be able to rederive anything I'd need, because my memory is too unreliable to trust with memorization. Repetition leads to boredom, which leads to loss of focus, which leads to forgetting.
Same. Memory is waaay to fickle. Repetition makes me feel like a cripple. But is ok, people with better hardware attention stack and neural DRAM can have the jobs. I'll be doing maintenance on their work for years.
You are damn right with the thing you described as an intersection of memorization and problem solving and not falling into extremes. This is exactly how they prepare kids for math olympiads or algorithmic contests. If you didn't attend one of those places, you can read interviews with people who scored top in those contests (look those up, they are extremely insightful) and sure, they will always tackle problems, usually giving them more time than an average person, but they won't go to the extreme to hang on it until they solve it. Which is the biggest mistake of people who try to prepare for those things on their own. You could tackle way more problems in the meantime and be more productive instead of headbanging a wall. And if you want to win those contests, you need to be first and foremost productive and on schedule. You can't do that effectively on your own. You need tutors, mentors to help you prod you just enough in the right direction. The tutor won't usually give you the answer straight away. But they know personally their pupils so they will just give you just enough hints for you to narrow down the discovery stage of the problem solving for you to go into the right direction saving you hours of low-productive work.
Took me too long to realise this, I used to think that all those top coders at codeforces were so great because they could come up with the solution of problems outta nowhere, until when I realised that a lot of it was just identifying the common patterns they've seen across multiple problems. Ofcourse there's problem solving as well but I thought only problem solving was required, I had no idea about identifying the common patterns, maybe if I did I'd atleast reach Candidate master level there
I have always felt that people with great memory are naturally more intelligent. Because they hold more data and are able to connect the relationships fasters and more intuitively than the rest of
After solving enough problem, a person would automatically skip that logical thinking part as the brain wouldve automatically memorised it due frequent usage of those concepts... That's why people say to grind daily
I wanna grind coding challenges, on edabit (generally easy), and codewars/leetcode (harder) but wanna keep a routine of x questions a day per day, how many do you think I should do? Coming from a cybersec student, generally find it difficult to program
I got two years (or one if im lucky) till I can get an internship, i started learning now but daily for two years seems like too much. Does it work like that? Or can I revisit it after doing all the questions now
8 month ago, I was afraid of taking the step to begin solving problem on leetcode. I was losing hope. Until i found your video that present your roadmap and neetcode. I started to follow the roadmap... Now i solved around 300 problems. Thanks not enough.
Generally when I can't get a problem and I have to look up a solution, I type up a pseudo-code of what I think I need to do and compare it to an actual result. If I atleast got the theory down and I am just missing a method or something, that is good, cause I was on the right track. If I was completely off then that is when I have to actively remind myself of what this stuff does cause I fundamentally messed up.
I always give a problem 20-30 mins, and if I can't figure it out I'll see if I can find some code that's trying to do ot a similar way and use that to get the rest of the way
Math major here: I am learning how to code and keep hearing people complain about ten or so different things for years. Finally learning about some of the things, and it's just been so thoroughly confusing as to why people struggle with this stuff. I am having trouble with really technical syntax problems, and when I take on simple problems I end up needing to look up how to actually do every new case I see. For example: I'll try to swap an item from different arrays and think: fuck I need to go back and spend another ten minutes figuring out the best way to do that again. But then I see leetcode problems and think jesus christ these are all so easy and try to figure out why people struggle with this stuff. Then I learn about more advanced concepts and think the same thing. Honestly this video has really changed my perception about how I view others in the coding community. Instead of thinking down on others for not immediately seeing the similarities between different concepts, I should be thinking about the ways I can grow my weaknesses and be thankful for the problem solving mindset I have been inadvertently creating over the past five or so years. For anyone reading this: I am sorry for not realizing some of the concepts in the video before
It really is good to probably to read a textbook or algos course before going hard on leetcode. I tried to learn straight by programming, and I did end up reinventing a few famous algos, which I guess was a learning experience but it consumed a lot of time. Some problems are borderline impossible if you don't know a lot of the fundamental CS algos.
Yes, patterns are much more important than solutions themselves. I've gotten to the point where I can solve almost any easy problem I encounter and about half of the medium problems I encounter thanks to you.
But can you solve them in O(N) instead of O(N**2) or O(log N) instead of O(N)? The initial solution is easy, its the optimized algorithm that gets me every time...
@@archardor3392 that is extremely problematic depending on the problem. maybe I could do that with my currrent skillset of pointers and pointer-arithmetics. but I doubt myself if it is about some really specific and efficient mathematical operation. I usually end up with O(N**2) solutions, not even O(log N).
The idea of memorizing core things and identify use cases obviously extends to many other fields, constructing a math proof is the obvious one. Another is modern experimental techniques in sciences. Many ground breaking new techniques are usually extensions of a classic experiment that exists in your intro textbooks that most students ignore.
During my college i have always been the guy who felt guilty on seeing the solution. I got good at problem solving, but couldn't solve many medium-hard interview problems because they surely required some memorisation of a pattern, which i couldn't invent at the moment.
Finally, someone convinced me that I'm not stupid for trying to solve medium/hard problems on LeetCode without looking at the solutions. I always tried to come up with solutions on my own without checking the walkthrough section. Sometimes I was able to find the answer, and sometimes I was not, which made me super disappointed. However, at the end of the day, there is nothing wrong with it. It's good to know.
100% correct. what i hate is, the people who need to hear this are the ones who basically just won't believe you when you say it. when students are trained from birth to fixate on "natural talent", they either give up altogether or they develop pathological methods for "learning" things like trying to memorize code line-for-line
This is the year where I will finally master DSA I have been on and off with leet code for the past 2 years. But never a consistant effort I just fall off after 1 or 2 months. Only to start again at the beginning. I no longer want to be disappointed in myself. This will not be for interviews, this will not be for getting a better job. I genuinly want to become better at programming and understand the craft.
Getting good at leetcode, i.e DSA questions will NOT make you a better programmer lol. You will almost never use anything you learnt from doing leetcode questions in your job. It's just a convenient way for companies to quickly test you. Being good at leetcode != Being a good programmer
If you want to get good at programming, then pick a project, and start working on it. If you get stumped anywhere, look up what stumped you and read until you understand what the results were trying to tell you. Do not copy and paste the snippets they give; read the text around the snippets so that you can translate the snippets from whatever language or framework they were originally written for into the language or framework that you initially chose to write in.
@@johnpaul4301although in some respect I understand your sentiment. I am already a professional programmer with 5YOE. And to be honest no you don’t need leetcode to write deploy and ship software. However to write good nay great software that is fast knowing your datastructures on top of solid engineering will make a big difference. Your product manager might not care but your users will care. And if you translate it well during performance reviews or switching jobs the interviewer will care. So a more nuanced take is necessary you need both! But yes you can indeed work with dsa but you can your job better with the knowledge :)
Spot on! The myth of learning by thinking and then solving seems deeply rooted within our culture. Learning is doing. Mastering is keeping at it. Thinking is, for the most part, done involuntarily by the brain, once it has the ingredients needed for the connections to slowly take place. It makes achievements sound a little less exciting, and our ideas of freedom and rationality somewhat less colorful, but it is how it is, and it works. Nice video! ❤
seriously love your videos, you are so good at explaining everything! I love your pro membership btw…you’ve saved me in coding interviews during this layoff period
Some problems doesn't have direct solution considering it's background. I met some some tasks (under String category) that had some insane solutions using prefix intersection counting which is no way deductible without proper background. So, yeah, strongly agree.
Me, only plan to code for fun, am gifted in pattern recognition(all eggs one basket), am too disabled to work. OP: It's just pattern recognition. Me: I...wanna do a coding interview. Maybe I could get a job in the field once I get better at it. Reason brain: No. Me: B-but! He said the magic words! He said pattern recognition. That's my thing! That's my ONLY thing! Reason brain: You have severe panic attacks and can barely English in interviews. This does you no good when you can't use it. Me: ...😭
Thank FUCK someone finally said it! Worse yet, for most SDE/MLE roles, there isnt a requirement for us to apply the more extreme levels of problem solving that leetcode hard problems demand. Most of these leetcode hard problems are extremely complicated and it is not even feasible for anyone, let alone an entry-level engineer to solve in 30 minutes, without knowing the actual solution beforehand. It is extremely frustrating when as a data scientist/mle, I have to solve weird problems that have very little/no bearing to my field of work. Personally, I have this rule of thumb when I consider whether or not an interview is going to be a fair assessment of my skills. If for an interview, I need to prepare for it like an examination (like solve problems from a dedicated "question bank" of sorts and in cases memorize the solutions etc), then I know for a fact that the interview is not going to be a fair assessment of my skills & talents. Interviews are ideally supposed to be a way of providing evidence of my skills that I have learnt/worked on; therefore they should not need dedicated prep time.
yeah, very good point, for too long I was on that green buble, and just tried to solve a problem with having no idea how to approach it. Even when knowing how to approach it - there's plenty of work in an interesting problem (and most of the real-world ones)
Yeah damn, amazing video. It’s one of those videos where the moment it’s said it’s like knowledge you’ve had all along, but you were the one to come along and help us rediscover it 😁 Thank you!
I tried for a job once, they gave me a single test to complete in a couple days it was supposed to be to get a thing to move to another thing and then back, and the instructions were to not give it discrete instructions on how to do a given thing, so you couldnt just say "turn left, then walk 4 spaces, then right, then walk 2" etc etc. I figured out a way to do it algorithmically where it figured out if it was capable of moving in any direction from its current position at each step and explored the area until it found the thing it wanted, and then explored until it found its way home (marked by a specific set of circumstances) It worked beautifully, the pawn moved around pretty weird but it would do as tasked (get the object, return to home) The company takes a week to get back to me and they say "we arent exactly sure what you did here." and im like, well what did you expect from the test then? and they basically explained that everyone just turns in a program that gives discrete instructions. so i say well thats the basic rule of the test is to NOT do that.. and they were like "well but everyone does." and im like "and you still hire them?" and they say "well yeah we just want to see how hard they try." and i refused to work for that company.
🎯 Key Takeaways for quick navigation: [00:01] Why LeetCode Might Not Be All It's Cracked Up to Be - LeetCode problems are not designed to teach you algorithms from scratch. - The focus is on applying memorized solutions rather than understanding core concepts. [00:27] LeetCode Interviews Compared to Long Multiplication - LeetCode emphasizes rote memorization over critical thinking, similar to how long multiplication is often taught in schools. - True understanding goes beyond memorizing steps. [02:57] Breaking Down Complex Problems - Complex problems can be solved by transforming them into simpler problems we already know how to solve. - This is the foundation of problem-solving and what LeetCode should be teaching. [03:12] Natural Aptitude Isn't Everything - While a strong math background can be beneficial, problem-solving can be learned and improved. [03:41] Finding the Balance Between Memorization and Problem-Solving - LeetCode should be used strategically to learn core algorithms, not memorize solutions for every problem. - The goal is to understand how to apply the right algorithms to different situations. Made with HARPA AI
i study in cse. but i don't learn anything from my college. our college has at most 30 students. but no one goes to college for class. so we don't even have a proper teacher in our college. so I learn everything myself. but when I started doing leetcode a month ago. i realized I need to learn math properly. so now I'm doing some youtube free course and reading some free pdf books. thank you for the tips.
easy problem statement is like "find the min value" and the solution be like: IMPLEMENT A BINARY BIT TREE OPERATION AND STORE EACH ELEMENT INSIDE A NODE THEN REVERSE THE TREE AND INVERSE IT AND APPEND EACH NODE TO ANOTHER TREE
"We all learned and remembered Long Multiplication" > Me with a Mathematics (-heavy Engineering in Computer Science) Degree : I've long forgotten these inferior techniques. for 55*32 I just turn it into (50+5)(30+2) and remember the elementary rules (50*30) + (50*2) + (5*30) + (5*2) , all of which are easy -> (50*10*3 = 500*3) ->1500 + 100 + 150 + 10 = 1760 I guess The processing rules are the same but this method is more explicit, simple, and compartmentalized (And therefore understandable, You know what's happening under the hood here unlike with Long Multiplication, I don't even care enough to know why you're "Carrying" the 1, You mean you're just adding by a different digit / power of 10? That's pretty dumb and overly confusing tbh, no wonder Americans are so terrible at math, Y'all have no freaking idea what's even happening, How do you expect to understand a subject like that?), and therefore its easier to do mentally and to double check for any issues or errors, and makes it so much easier for others to look at the same problem and understand and confirm what you're doing. EDIT : Full disclaimer, I paused at the long multiplication step to write this comment before continuing to see you basically did the same thing. Now Just do the latter everywhere and the former is not needed for anything, anywhere ever again, and can be banished to forgotten history where it belongs.
I like to call it "if you want to program a computer, you need to think like a computer". Without an oscilloscope, you don't know what's going on with your Arduino, we don't have sensors for electronic logic signals. With software it's even worse. You can't connect a probe to a CPU register. The only way to do it is to carefully recreate the program logic in your head, then validate the assumptions, and remember about those edge cases! And that's why most people can't be good programmers. Everyday life is observable and political. You can survive quite well without logic, really, if you tell the right words to the right people to make them feel like giving you money. When baking bread, you can see the consistency, the preparedness, the color at every step. With computers not so much. This is why web development is so popular - you see what you're doing, it's like LEGO, and Developer Tools in Chrome do all the work of visualization for you. Fun fact, LeetCode problems are very similar to math problems we were solving when I was a kid in a math school. LeetCode is literally a subset of Project Euler.
Love your content, you bring to light ideas some knew but couldn’t articulate and others just completely miss. Sent a donation for support I encourage others to do the same, this is valueble content
@0:06 "Just solve some [basic] linked list 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". Agreed this is absolutely ridiculous - because chances are high that this knowledge won't be useful where you're working; direct experience (i.e., domain knowledge or knowledge of the tools used on the job) is more valuable. BUT, you have to admit, knowing that this arcane compsci sh*t algorithm exists will allow you apply it when the occasion presents itself. And at least knowing about it and how it applies to a LC problem is better than not knowing it at all. BUT, this knowledge is only useful for solving a technical that masquerades as a business problem. It has no value in assessing a candidate's potential.
I had a perfect understanding of why the multiplication algorithm works. And long division. That's why I was easily able to see how I could use it to divide or multiply polynomials, hor example. I taught calculus for about a decade, and this description of pattern recognition reminds me of the way I taught students to do complex integrals.
This is a good video. You teaching us how to turn a multiplication problem into an addition problem really breaks down how math isn't complicated unless you make it so.
My grandpa would spend days on a single math problem when he was young and he became one of the best mathematicians in the entire country, he had an important role creating and decoding encryption which not many scientists are capable of doing. He always told me solve hard problems without looking at the solution and take as much time as you need, if it is several days then so be it. This worked for him, he became one of the best of the best in the entire country.
Re 3:05 transforming multiplication to an addition problem is called logarithms. From the tables 55 = e^4.007 and 32 = e^3.466. So, e^4.007*e^3.466 = e^7.473 an looking back at our tables e^7.433 = 1760 rounded to our 4 digit accuracy.
Totally agree, I realized it was better to cheat and look at the solution if i couldn't figure it out by myself in 20 or 30 minutes. Looking at the solution gave a complete new insight
Basically how we learn college level maths anyways. Unless you're an acamedic/researcher, people just grind math problems by looking at the correct solutions when they fail
I just had this same thought, and damn, Neetcode himself lays it down in a video. Leetcode is not strictly an intelligence test, it's a memorization and pattern recognition test. Hell, looking at modern machine learning algorithms (which are frickin' good at leetcode), perhaps that's all intelligence is?
Basically try not to make the model underfit by expecting to learn by thinking. Take the training data and learn. You'll feel dumb but remember you're getting better eventually. Eventually this will become a habit and you'll see patterns in problems you had no idea about at first.
Not only that but the integral problem I’m seeing with LeetCode is its deviation from real-life programming (in relation to most of the tech field positions). Naturally improving at LeetCode also means improving as a programmer, but what’s interesting to see is how little it applies to the job market.
This is true. Some algorithms are a result of PhD research and there’s tagged “hard” on leetcode where candidates are expected to solve under 20 mins in interview setting. Ridiculous. Unless you’ve devoted time to solve the same variations and have memorised the algorithm it’s impossible in an interview setting to anywhere get close to even making past 20% of test cases. Oh, and there’s tons of such problems.!
The reason I like leetcode is that there are a shitload of (to me) novel problems. Usually I think of the naive solution, then look up the optimal solution. That's how you learn. You think then you improve
And the multiplication they taught us as kids is the absolutely the worst way to do it. It is tough to do it in your head. But then, teachers will always want to "see your work", so they choose this obtuse way to do it. I simply just factor the numbers in my head and recombine the primes to get to the answer. Or, I just whip out the calculator. Leet Code is a joke. Most of them I can do very easily. The problem I have with Leet Code is that they are timed, which takes all the fun out. In the real world, you typically have a lot more time to solve problems than just a few minutes. For instance, I had a multilateration problem to solve once, and I could not find any off the shelf solutions that worked. Most only involved 2 or 3 nodes. I had to solve it for many nodes detecting the BLE beacons that were to be used to track the location of pallets on the factory floor. Took me 2 or 3 days, but I did it.
I was thinking leetcode is just partially understanding + some memorization before I opened this video and this guy said exactly what I had in mind❤ 4:19
the grade school math example is extremely apt; asking senior/staff level candidates to remember things from school (20-40 years ago) and then equating that with “problem solving skills” is exactly whats wrong with leetcode
I realized this after completed a few dozens of problems. All them already had efficient solutions, and"my" solutions will not bet them (at least in efficiency). It's not because I'm not smart enough, but because all of them required different mindset, and different experience. I also notice that all efficient solutions of different problems was in invented by different people, doesn't it looks interesting? To summarize, don't reinvent the wheel. Your goal is to learn how to ride it.
I agree because unless you are hired for research under a reputed research organization, you shouldn't care how multiplication works. In the interviews, you always JUST need to know the multiplication trick.
The more neural connections you have, the higher the chances that forming new ones will not take much time and effort. When I was studying computer science, my classmates did not understand and were surprised how I could remember several pages of text after reading it once and could then successfully pass exams. I tried to explain to them that I studied at a good school, where from the first grade we were forced to memorize a page of text every week, and at the end of the year we had to recite all the pages that we had learned. With this approach, connections are gradually developed that allow you to understand everything very quickly in the future. But this must be done in childhood. This trick will be much more difficult for adults to do. Learn things by heart. Don't listen to those who say otherwise. First comes quantity, and then it turns into quality. The most important philosophical principle.
Thanks bro for such beautiful piece of content... From last to years I am banging my head against wall(you know what I mean) but can't solve questions on my own... Now some questions can be solved... Your intersection approach (in this video) is what I was desperately searching for. Thanks a lot a lot alot brother 😅😅
Damn I almost forgot I even had this channel.
🌍 The Roadmap: neetcode.io/roadmap
✏ The practice page: neetcode.io/practice
🚀 My second YT channel: youtube.com/@NeetCodeIO
🔥 Pro neetcode.io/pro
what tool he using to draw like that? wacom?
does neetcode have Lua?
@@a55tech Paint 3D with a mouse
@@NeetCodeA mouse?! How is your drawing motion so fluid with a mouse? Or is it a trackpad :0
bringup more
You had me at the Naruto Chunin Exams reference
He had me "don't forget to like and subscribe"
He had me "Just improve your problem solving skills and you'll be able to pass every coding interviews."
Which episode is that? Would like to watch it
It is right in the beginning. According to google, episode 24. Since it's not that much, I'd recommend watch from the 1st episode. It is really fun!@@agamersdiary1622
@@agamersdiary1622~ep 30
I am a farmer and will try memoizing instead of memorizing from now on 😅
farmers are smart
Mathematicians are in shambles
@@Mglunafh
Can confirm. Mathematician here, in complete shambles
@@Mglunafhas a student of applied maths and informatics I too am in complete shambles
Bro just get his point
Thanks a lot for your effort.
I looked at your blind75 solutions and coded them along the way, I even used the debugger sometimes.
After 2 weeks (left time to ensure I dont write off of memory), I tried to solve the problem on my own. If I could figure out the patterns, it was a matter of 10 mins to code. Sure I had some edge case issues but now I am in much better shape.
Your videos explain the logic very well.
I used to feel very bad when I was doing this for the first time and couldnt see the solution right away. But as you said, this is the learning phase.
After finishing the 75 problems for the 2nd time I was able to solve others by applying the patterns. And got confidence along the way.
I am not interested in joining faangs, I study for my own knowledge and to become a better interviewer.
A tip for folks: the best time to prepare is when you are not looking for a job.
Blind75* . Well done, bro!
@@belphegor32 thx, I fixed it
TC?
Wow that's amazing man.
How much time did it take for you complete the blind 75 twice. How many hours you spent per day.
I'd like to know if we only do leetcode if we are aiming at FAANGs.
5 months ago, I couldn't solve any easy problems, but after 5 months of Neetcode, I can finally solve easy and medium problems by myself
Well done. Wow. What was your daily schedule like?
How do you not get bored?? How do you stay motivated
Discipline@@krox477
I still can't solve easy solutions without looking at solutions.
But with anything if you do not enjoy or at least show up to it almost everyday try to find something where you can
When I was training BJJ it was 4-5 times a week (some days were rough) but you still show up@@krox477
After 5 months bro declared me a farmer :)
I just learned how multiplication works from this video😂😂
"things they don't teach you in school" :D
@@juanmacias5922just community school things
Wait you just did? I feel bad for you and your school system.
Check out the Karatsuba Algorithm as well, it' even funnier
I was too shy to put this up😂
Ironically, the majority of programmers can't solve those problems off the top of their head in the 15 - 45 minute time window under extreme pressure. Coding questions are fundamentally broken. You end up with people who memorize the top questions but have no idea about calculating time complexity or system architecture. They end up turning an API into 10 microservices even though their system only has to support 1000 users per hour.
ouch. i can feel that past experience of yours. i saw the same crazy microservices get-bankrupt-fast scheme
Now with serverless, those 10 microsservices became 100 nanosservices to "minimize costs" and there's unreadable, unmaintainable scripts all over the place taping everything together
@@yFortuna, the irony is it costs more in server time and man hours
Person hours
Idiot admires complexity, genius appreciates simplicity. I once worked with a tech pro and he got upset because he didn't get the chance to smash perfectly fine system that were making money to pieces and rebuild how he wanted it to be. 😂
Thanks for putting some light on this. I'm working on turning my coding hobby into a career change, and I love trying to solve difficult problems (LC or otherwise) on my own. Sometimes I need a little reminder that my goal is learning, not just rediscovering the wheel. Gotta stay balanced.
Lots of companies just need help with basic shit. Good luck!
there are some wheels you will never be able to reinvent on your own.
@@sapientum08 inventing wheels is a great way to get a publication, but using wheels is a great way to get a job
This is 100% true, at least in my life. My final exam for Data Structures and Algorithms I failed 2 coding problems, professor asked to hand write pseudo code, I tried, but it was a mess whether this was due to nervousness, or just not believing in myself, I honestly can't say. We were taking the exam 1 on 1 via Zoom call (this is 2020, covid). He took a long look at my solutions and plainly asked me how would I solve it, in plain english, so I told him, and he walked me through writing that out in a pseudo way. I knew how to solve it, I just needed him to ask me questions. So, TLDR, never doubt yourself, and IMO always learn how to solve a problem, intimately, no matter what. Even if it's simple, it's all building blocks and it continues for the rest of your life. Super long comment, but Thank you Neet, you've made a big difference in my life!
Damn i have my data structures and algo final exam this afternoon and i've just been studying for it by practicing enough problems so that i will have technically "seen" any type of problem that appear on the exam (this is how i've done well in every single exam my life).
That sounds like an awesome teacher, btw.
w professor
You had good professor
Example of why compsci CAN be flawed, and how good teaching bridges it.
NeetCode is probably one of the best resources for technical interview preparation.
I just got accepted to a Google Software Engineering Internship that starts this June, and I wouldn't have made it without your help.
I owe you a huge one, brother.
Cheers,
Tom
Do you have any advice? I have a OA due Monday, but I mainly use SQL in my current role. It's not an option, so I'm trying to pivot to Python,. It's been difficult learning so far, but I really want to do well. I figure they must have liked my background if i passed the screening and received the OA. But I really want to perform well. Life changing opportunity.
@@TDMac11 My OA was two leetcode style questions, and I was lucky enough to receive two that were not too hard. My assumption is that they are randomized from a dedicated set of questions with varying difficulty.
At this point they are checking mostly for correctness and not for efficiency. For one of the questions I submitted a suboptimal solution in O(n) even though there existed an O(1) solution, but it was correct so it passed. So one advice would be maybe don't jump over your head trying to over-optimize your solution. Write something that works, and then test the hell out of it with as many cases as you can think of. You may, of course, try to optimize your solution if you think there is room for that, but it might be a good idea to have something suboptimal as a backup.
Note that on the technical interview stages you will be evaluated by your ability to optimize your solutions so this tip is only for the OA.
For preparation I used the Neetcode roadmap and I think it was really good. If you have a lot of free then it might be a good idea to try to complete the entire thing (might take a while but totally worth it). If your free time is limited then I'd try to do 1-2 easy and 1-2 medium questions from as many topics in the roadmap as possible, preferably in the order they appear in the roadmap. If you have very little time then maybe focus on topics you find more challenging or are less familiar with. Important note - hard questions are not worth the time at this point.
Good luck my friend!
wow 30 uhh units of money
@@poleve5409about 20p in great british patriotic pounds
Interviewing in tech has become a job in itself. And for live coding interviews you need to have memorized syntax and problem patterns so well that you have to make it look like you are seeing the problem for first time and act as if you are coming up with a solution on the spot. If you answer quickly then too bad 😆. Tech is mainstream now so whatever rules few prominent companies set the rest blindly follow. 10 years back, one would have attended different formats at diff companies a whiteboard interview at 1 company, a phone coding interview at another and in-person coding at some others.
I don't think it's necessarily true that you have to act like you're seeing it for the first time.
Even in interviews I've conducted or I've seen other people conduct, nobody is taken by surprise if you are familiar with an optimal solution.
The important bit is to be able to write correct and clearly understandable code. If you prematurely write an optimized algorithm whose solution you're not comfortable with, you're likely going to bomb the interview.
I don't think this is the correct way to think about this.
You don't need to memorize the syntax and pretend you are seeing it on the stop. I'm and interviwer and have completed something like 200 interviews in my career.
The biggest thing we are looking for is your thought process. Do you understand the problem deeply? Can you have a conversation about it? Are you stumbling around basic coding skills like writing a for loop... or does it come naturally to you? Does this person overcomplicate things to try to impress me?
life is so fucked when you need another job to find a job
If you solve the question too fast, the interviewer will come with another one. The goal is to keep you talking (pretty much as a hostage negotiation 🤔), not check if you solve the problem or not
reg the 101's of interviews and its purpose that few comments brought up - I get the basics and expectations of interviews since i have been a interviewer too. Some further thoughts 1. In a live interview, anyone who hasn't heavily practiced leetcoding will go though a process of assumptions and errors to come to a correct solution. without knowing the pattern, i'm not sure if a leetcode medium-hard can be written with a minimum complexity nlogn solution in 30-45 mins. 2. Most interviewers are too rigid and some even go on to infer negatively if you refer syntax ( ** syntax here doesn't necessarily mean how to write a for loop or looking up basic ds functions) - language specific details like default behaviour of an in-built methods or methods/arguments. If you have to remember such details on top of your head then it means as a developer you are not allocating enough space for higher complicated problems. Interviews are all about testing your understanding of cs concepts and not about how fast you can recollect some details that you can easily look up or learn with some effort.
How to learn efficiently is more important than how much you learned
How do you learn efficiently
Answer the question now?
Wrong. It should be both. Learn a lot and learn efficiently.
@@asagiai4965 but each person has a capacity.
@@zorzem3290im curious also
FYI, if a farmer didn’t have great problem solving skills they would be bankrupt very quickly. They are not a group you should underestimate.
Not to mention calculating risks through various variables that are present like the weather and possible diseases. A farmer is a little bit of "know-it-all" kind of profession.
Survivor bias. The "developed" world hates farmers. Simple as.
@@stereomachine Wait, you think farming used to the easier in the past?
Lmao! 🤣
@@Ebani Farming was easier in terms of expectations. You were just expected to diligently work your field and not be lazy about it. Modern day, you're expected to use modern techniques and approach the problem of farming with some degree of scientific and engineering discipline.
You can still make a miscalculation in either environment and turn out a poor harvest. The difference is that in the past nearly every other farmer wasn't doing any better so you were still generally competitive, while today, you'd go bankrupt.
2 points you might be missing: while it is true that farming isn't easy(it actually is pretty hard), the barrier to entry to farming is a lot lower than it is for mathematics. How long do you think it will take for someone and what percentage of the population do you think will be somewhat productive as a farmer? I would say the vast majority of people will probably be somewhat competent in farming in a couple of years. Contrast that with mathematics, to be able to actually do anything useful with it, you need to study it from elementary school to high school (and that's being generous). Even then, the vast majority of people just end up "not getting it".
Secondly, I think you're underestimating how hard it is to do something so abstract like math. Have you ever seen the meme of some dude having difficulty doing fractions, but as soon as it's related to something like pizza and beer, it suddenly gets a lot easier? That's the same thing with farming and math. Farming is a very concrete task. You know what you want to do, you can see what you want to do, you can see it as you're doing it. Math is way more abstract. There isn't a way to check what you're doing is right unless you have a teacher or a calculator with you. And that's only arithmetic. I'm an engineer and the amount of engineers that get by without using math is astonishing to me. I'm one of the lucky few in my workplace that actually "gets it" and actually do end up using math for tasks. It's a surprisingly rare skill even amongst the "intelligent".
I always thought people invented the algorithms to solve these problems on the fly before I learned that they were just applying what they had memorized and practiced many times before. The same is applicable for things like math olympiads, too.
Some of these algorithms took very smart people a very long time to prove and formalize. No one can come up with that in 30 mins
@@NihongoWakannai Definitely. Took me way too long to learn this, though.
@@NihongoWakannaiNo, it's intelligent people not "smart people" who made those algorithms.
Smart people used intelligent people algorithms to make money like Jeff Bezos who made Amazon. He studied computer science and he used his knowledge from school to make a book e-commerce website from using intelligent people program languages like html css js and ruby.
Naruto is a good example describing smart people. If you take Naruto vs Neji. It was about Intelligent vs smart. Neji was the a spoil intelligent kid who parents brainwashed him to think he was superior and smarter than anyone else because his parents was feeding him lessons and knowledge. Naruto grow up thriving into a world with no parents. But Naruto showed him his place where intelligent people aren't like smart people. Smart people find shortcuts to beat intelligent people.
@@sukapow bro I did not expect the business bro jeff bezos talk to switch into the weeb naruto talk, you really hit me with that mixup
@@sukapow Gotta give credit to the inventors though. Most of us don't wanna be the ones figuring out how algorithms are designed and proven to work, we just wanna use the tools to create whatever software that we want. It took these geniuses hundreds and thousands of hours of heavy thinking so that we can learn it within an hour or 2. So no one's "beating" each other, and I don't like how its gotta be a competition when the fact is, we wouldn't know about these things if it weren't for the intelligent.
I made a
mistake and started cramming for two weeks when i was given a coding assessment by Amazon. Needless to say, it was a dumpster fire. As a senior engineer, it hurt my ego, but reinforced just how technical and isolated this area of prep is. I need to take the proactive approach, studying a little each day for months.
Honest question, how could leetcode be so different to what you do as a software engineer that you couldn't pass as a senior engineer?
Unfortunately, when I solve the next 10 problems, I forget the details of how I solved the previous 10. Yes, I remember what there was a pattern, but the problem is that each pattern often has several modifications, those very details that I forget and cannot reproduce again two weeks later.
I also noticed that if a solution is unintuitive for me, then even having analyzed and understood the solution, for my thinking it still remains unintuitive due to which neural links do not appear and my internal garbage collector removes it from memory ))
Repetition is the key
Keep going. It takes 6+ months or years
This is why I prefer to be able to rederive anything I'd need, because my memory is too unreliable to trust with memorization.
Repetition leads to boredom, which leads to loss of focus, which leads to forgetting.
Same. Memory is waaay to fickle. Repetition makes me feel like a cripple. But is ok, people with better hardware attention stack and neural DRAM can have the jobs. I'll be doing maintenance on their work for years.
Maybe you could try to write some sort of documentation exploring the theoretic part of it and if there would be more efficient solutions.
You are damn right with the thing you described as an intersection of memorization and problem solving and not falling into extremes. This is exactly how they prepare kids for math olympiads or algorithmic contests. If you didn't attend one of those places, you can read interviews with people who scored top in those contests (look those up, they are extremely insightful) and sure, they will always tackle problems, usually giving them more time than an average person, but they won't go to the extreme to hang on it until they solve it. Which is the biggest mistake of people who try to prepare for those things on their own. You could tackle way more problems in the meantime and be more productive instead of headbanging a wall. And if you want to win those contests, you need to be first and foremost productive and on schedule. You can't do that effectively on your own. You need tutors, mentors to help you prod you just enough in the right direction. The tutor won't usually give you the answer straight away. But they know personally their pupils so they will just give you just enough hints for you to narrow down the discovery stage of the problem solving for you to go into the right direction saving you hours of low-productive work.
Took me too long to realise this, I used to think that all those top coders at codeforces were so great because they could come up with the solution of problems outta nowhere, until when I realised that a lot of it was just identifying the common patterns they've seen across multiple problems. Ofcourse there's problem solving as well but I thought only problem solving was required, I had no idea about identifying the common patterns, maybe if I did I'd atleast reach Candidate master level there
polska😮
Would appreciate if you do more of videos like this. They really help.
I have always felt that people with great memory are naturally more intelligent. Because they hold more data and are able to connect the relationships fasters and more intuitively than the rest of
After solving enough problem, a person would automatically skip that logical thinking part as the brain wouldve automatically memorised it due frequent usage of those concepts... That's why people say to grind daily
While this is true, the main reason you should grind daily is because because it normalizes the process which reduces (and mostly eliminates) anxiety.
That's not only memorization, it's building intution by familiarizing yourself with patterns
wish i can memorize that easily
I wanna grind coding challenges, on edabit (generally easy), and codewars/leetcode (harder) but wanna keep a routine of x questions a day per day, how many do you think I should do? Coming from a cybersec student, generally find it difficult to program
I got two years (or one if im lucky) till I can get an internship, i started learning now but daily for two years seems like too much. Does it work like that? Or can I revisit it after doing all the questions now
8 month ago, I was afraid of taking the step to begin solving problem on leetcode. I was losing hope. Until i found your video that present your roadmap and neetcode. I started to follow the roadmap... Now i solved around 300 problems. Thanks not enough.
Funny how this came when I needed it. Thanks NeetCode. People like you make this world easier for newcomers like me.
Generally when I can't get a problem and I have to look up a solution, I type up a pseudo-code of what I think I need to do and compare it to an actual result. If I atleast got the theory down and I am just missing a method or something, that is good, cause I was on the right track. If I was completely off then that is when I have to actively remind myself of what this stuff does cause I fundamentally messed up.
@@WORK-qw7vsp and c?
I always give a problem 20-30 mins, and if I can't figure it out I'll see if I can find some code that's trying to do ot a similar way and use that to get the rest of the way
😮 that's exactly what I do I thought it was dumb or something.
Math major here: I am learning how to code and keep hearing people complain about ten or so different things for years. Finally learning about some of the things, and it's just been so thoroughly confusing as to why people struggle with this stuff. I am having trouble with really technical syntax problems, and when I take on simple problems I end up needing to look up how to actually do every new case I see. For example: I'll try to swap an item from different arrays and think: fuck I need to go back and spend another ten minutes figuring out the best way to do that again. But then I see leetcode problems and think jesus christ these are all so easy and try to figure out why people struggle with this stuff. Then I learn about more advanced concepts and think the same thing. Honestly this video has really changed my perception about how I view others in the coding community. Instead of thinking down on others for not immediately seeing the similarities between different concepts, I should be thinking about the ways I can grow my weaknesses and be thankful for the problem solving mindset I have been inadvertently creating over the past five or so years. For anyone reading this: I am sorry for not realizing some of the concepts in the video before
It really is good to probably to read a textbook or algos course before going hard on leetcode. I tried to learn straight by programming, and I did end up reinventing a few famous algos, which I guess was a learning experience but it consumed a lot of time. Some problems are borderline impossible if you don't know a lot of the fundamental CS algos.
Yes, patterns are much more important than solutions themselves. I've gotten to the point where I can solve almost any easy problem I encounter and about half of the medium problems I encounter thanks to you.
But can you solve them in O(N) instead of O(N**2) or O(log N) instead of O(N)? The initial solution is easy, its the optimized algorithm that gets me every time...
@@archardor3392 for easys, yes. I feel like they're more a test of your DS knowledge than techniques. mediums and up are more technique focused
@@archardor3392 that is extremely problematic depending on the problem.
maybe I could do that with my currrent skillset of pointers and pointer-arithmetics.
but I doubt myself if it is about some really specific and efficient mathematical operation.
I usually end up with O(N**2) solutions, not even O(log N).
The idea of memorizing core things and identify use cases obviously extends to many other fields, constructing a math proof is the obvious one. Another is modern experimental techniques in sciences. Many ground breaking new techniques are usually extensions of a classic experiment that exists in your intro textbooks that most students ignore.
OMFG YOU JUST GAVE ME PURPOSE TO LIVE MY LIFE AGAIN
Frrrr, i was about to give up, not just coding but give up on life in general 🥲🥲
@@adib4361 Dude, are u ok? Please tc
During my college i have always been the guy who felt guilty on seeing the solution. I got good at problem solving, but couldn't solve many medium-hard interview problems because they surely required some memorisation of a pattern, which i couldn't invent at the moment.
Finally, someone convinced me that I'm not stupid for trying to solve medium/hard problems on LeetCode without looking at the solutions. I always tried to come up with solutions on my own without checking the walkthrough section. Sometimes I was able to find the answer, and sometimes I was not, which made me super disappointed. However, at the end of the day, there is nothing wrong with it. It's good to know.
100% correct.
what i hate is, the people who need to hear this are the ones who basically just won't believe you when you say it.
when students are trained from birth to fixate on "natural talent", they either give up altogether or they develop pathological methods for "learning" things like trying to memorize code line-for-line
if you’re in top colleges, most people say this and they can actually pull it off. it’s hell.
What an amazing start! I'm sure 99% didn't know why that multiplication worked, including me until today. :D Thanks for it.
This is the year where I will finally master DSA I have been on and off with leet code for the past 2 years. But never a consistant effort I just fall off after 1 or 2 months. Only to start again at the beginning.
I no longer want to be disappointed in myself.
This will not be for interviews, this will not be for getting a better job.
I genuinly want to become better at programming and understand the craft.
Getting good at leetcode, i.e DSA questions will NOT make you a better programmer lol. You will almost never use anything you learnt from doing leetcode questions in your job. It's just a convenient way for companies to quickly test you. Being good at leetcode != Being a good programmer
You're just gonna give up again like the last 2 years.
If you want to get good at programming, then pick a project, and start working on it. If you get stumped anywhere, look up what stumped you and read until you understand what the results were trying to tell you. Do not copy and paste the snippets they give; read the text around the snippets so that you can translate the snippets from whatever language or framework they were originally written for into the language or framework that you initially chose to write in.
@@Bromon655still going strong :)
@@johnpaul4301although in some respect I understand your sentiment. I am already a professional programmer with 5YOE. And to be honest no you don’t need leetcode to write deploy and ship software. However to write good nay great software that is fast knowing your datastructures on top of solid engineering will make a big difference. Your product manager might not care but your users will care. And if you translate it well during performance reviews or switching jobs the interviewer will care. So a more nuanced take is necessary you need both! But yes you can indeed work with dsa but you can your job better with the knowledge :)
Spot on! The myth of learning by thinking and then solving seems deeply rooted within our culture. Learning is doing. Mastering is keeping at it. Thinking is, for the most part, done involuntarily by the brain, once it has the ingredients needed for the connections to slowly take place. It makes achievements sound a little less exciting, and our ideas of freedom and rationality somewhat less colorful, but it is how it is, and it works. Nice video! ❤
So memorize all of the problem solutions, got it.
seriously love your videos, you are so good at explaining everything! I love your pro membership btw…you’ve saved me in coding interviews during this layoff period
Some problems doesn't have direct solution considering it's background. I met some some tasks (under String category) that had some insane solutions using prefix intersection counting which is no way deductible without proper background. So, yeah, strongly agree.
It’s insane how you really made something out of what you love doing the most. 🙏🏾💯
Me, only plan to code for fun, am gifted in pattern recognition(all eggs one basket), am too disabled to work.
OP: It's just pattern recognition.
Me: I...wanna do a coding interview. Maybe I could get a job in the field once I get better at it.
Reason brain: No.
Me: B-but! He said the magic words! He said pattern recognition. That's my thing! That's my ONLY thing!
Reason brain: You have severe panic attacks and can barely English in interviews. This does you no good when you can't use it.
Me: ...😭
Fantastic video! Loved how you broke down the actual concept of problem solving in an easy-to-understand way :)
Thank FUCK someone finally said it!
Worse yet, for most SDE/MLE roles, there isnt a requirement for us to apply the more extreme levels of problem solving that leetcode hard problems demand. Most of these leetcode hard problems are extremely complicated and it is not even feasible for anyone, let alone an entry-level engineer to solve in 30 minutes, without knowing the actual solution beforehand. It is extremely frustrating when as a data scientist/mle, I have to solve weird problems that have very little/no bearing to my field of work.
Personally, I have this rule of thumb when I consider whether or not an interview is going to be a fair assessment of my skills. If for an interview, I need to prepare for it like an examination (like solve problems from a dedicated "question bank" of sorts and in cases memorize the solutions etc), then I know for a fact that the interview is not going to be a fair assessment of my skills & talents. Interviews are ideally supposed to be a way of providing evidence of my skills that I have learnt/worked on; therefore they should not need dedicated prep time.
yeah, very good point, for too long I was on that green buble, and just tried to solve a problem with having no idea how to approach it.
Even when knowing how to approach it - there's plenty of work in an interesting problem (and most of the real-world ones)
Yeah damn, amazing video. It’s one of those videos where the moment it’s said it’s like knowledge you’ve had all along, but you were the one to come along and help us rediscover it 😁
Thank you!
I tried for a job once, they gave me a single test to complete in a couple days
it was supposed to be to get a thing to move to another thing and then back, and the instructions were to not give it discrete instructions on how to do a given thing, so you couldnt just say "turn left, then walk 4 spaces, then right, then walk 2" etc etc.
I figured out a way to do it algorithmically where it figured out if it was capable of moving in any direction from its current position at each step and explored the area until it found the thing it wanted, and then explored until it found its way home (marked by a specific set of circumstances)
It worked beautifully, the pawn moved around pretty weird but it would do as tasked (get the object, return to home)
The company takes a week to get back to me and they say "we arent exactly sure what you did here."
and im like, well what did you expect from the test then?
and they basically explained that everyone just turns in a program that gives discrete instructions.
so i say well thats the basic rule of the test is to NOT do that..
and they were like "well but everyone does."
and im like "and you still hire them?"
and they say "well yeah we just want to see how hard they try."
and i refused to work for that company.
i clapped for you along with everyone
@@seedee3d 💓
🎯 Key Takeaways for quick navigation:
[00:01] Why LeetCode Might Not Be All It's Cracked Up to Be
- LeetCode problems are not designed to teach you algorithms from scratch.
- The focus is on applying memorized solutions rather than understanding core concepts.
[00:27] LeetCode Interviews Compared to Long Multiplication
- LeetCode emphasizes rote memorization over critical thinking, similar to how long multiplication is often taught in schools.
- True understanding goes beyond memorizing steps.
[02:57] Breaking Down Complex Problems
- Complex problems can be solved by transforming them into simpler problems we already know how to solve.
- This is the foundation of problem-solving and what LeetCode should be teaching.
[03:12] Natural Aptitude Isn't Everything
- While a strong math background can be beneficial, problem-solving can be learned and improved.
[03:41] Finding the Balance Between Memorization and Problem-Solving
- LeetCode should be used strategically to learn core algorithms, not memorize solutions for every problem.
- The goal is to understand how to apply the right algorithms to different situations.
Made with HARPA AI
i study in cse. but i don't learn anything from my college. our college has at most 30 students. but no one goes to college for class. so we don't even have a proper teacher in our college. so I learn everything myself. but when I started doing leetcode a month ago. i realized I need to learn math properly. so now I'm doing some youtube free course and reading some free pdf books. thank you for the tips.
Thanks! I now understand more about the trick to tackle leetcode😮
easy problem statement is like
"find the min value"
and the solution be like: IMPLEMENT A BINARY BIT TREE OPERATION AND STORE EACH ELEMENT INSIDE A NODE THEN REVERSE THE TREE AND INVERSE IT AND APPEND EACH NODE TO ANOTHER TREE
This is shockingly grounded and reasonable advice for TH-cam 😂
This video is a game-changer! Problem-solving skills are key to acing coding interviews. Focus on core algorithms and pattern recognition. Great tips!
Mom wake up new Neetcode vid just dropped
Alright, I am entering the game, it’s over for you guys!
Well that was the most aggressive explanation of multiplication i've heard
"We all learned and remembered Long Multiplication"
> Me with a Mathematics (-heavy Engineering in Computer Science) Degree : I've long forgotten these inferior techniques.
for 55*32 I just turn it into (50+5)(30+2) and remember the elementary rules (50*30) + (50*2) + (5*30) + (5*2) , all of which are easy -> (50*10*3 = 500*3) ->1500 + 100 + 150 + 10 = 1760
I guess The processing rules are the same but this method is more explicit, simple, and compartmentalized (And therefore understandable, You know what's happening under the hood here unlike with Long Multiplication, I don't even care enough to know why you're "Carrying" the 1, You mean you're just adding by a different digit / power of 10? That's pretty dumb and overly confusing tbh, no wonder Americans are so terrible at math, Y'all have no freaking idea what's even happening, How do you expect to understand a subject like that?), and therefore its easier to do mentally and to double check for any issues or errors, and makes it so much easier for others to look at the same problem and understand and confirm what you're doing.
EDIT : Full disclaimer, I paused at the long multiplication step to write this comment before continuing to see you basically did the same thing. Now Just do the latter everywhere and the former is not needed for anything, anywhere ever again, and can be banished to forgotten history where it belongs.
I like to call it "if you want to program a computer, you need to think like a computer".
Without an oscilloscope, you don't know what's going on with your Arduino, we don't have sensors for electronic logic signals.
With software it's even worse. You can't connect a probe to a CPU register.
The only way to do it is to carefully recreate the program logic in your head, then validate the assumptions, and remember about those edge cases!
And that's why most people can't be good programmers.
Everyday life is observable and political.
You can survive quite well without logic, really, if you tell the right words to the right people to make them feel like giving you money.
When baking bread, you can see the consistency, the preparedness, the color at every step.
With computers not so much.
This is why web development is so popular - you see what you're doing, it's like LEGO, and Developer Tools in Chrome do all the work of visualization for you.
Fun fact, LeetCode problems are very similar to math problems we were solving when I was a kid in a math school.
LeetCode is literally a subset of Project Euler.
Love your content, you bring to light ideas some knew but couldn’t articulate and others just completely miss. Sent a donation for support I encourage others to do the same, this is valueble content
Thank you so much 🙏
@0:06 "Just solve some [basic] linked list 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".
Agreed this is absolutely ridiculous - because chances are high that this knowledge won't be useful where you're working; direct experience (i.e., domain knowledge or knowledge of the tools used on the job) is more valuable.
BUT, you have to admit, knowing that this arcane compsci sh*t algorithm exists will allow you apply it when the occasion presents itself. And at least knowing about it and how it applies to a LC problem is better than not knowing it at all.
BUT, this knowledge is only useful for solving a technical that masquerades as a business problem. It has no value in assessing a candidate's potential.
@3:13-4:46 Yup. Spot on.
How am I just now finding your website. What you put together is fucking sick. Thank you
I had a perfect understanding of why the multiplication algorithm works. And long division. That's why I was easily able to see how I could use it to divide or multiply polynomials, hor example.
I taught calculus for about a decade, and this description of pattern recognition reminds me of the way I taught students to do complex integrals.
Most of the problems are so boring to even read on Leet code.
This is a good video. You teaching us how to turn a multiplication problem into an addition problem really breaks down how math isn't complicated unless you make it so.
My grandpa would spend days on a single math problem when he was young and he became one of the best mathematicians in the entire country, he had an important role creating and decoding encryption which not many scientists are capable of doing. He always told me solve hard problems without looking at the solution and take as much time as you need, if it is several days then so be it. This worked for him, he became one of the best of the best in the entire country.
Uploaded 1 day ago! Bro we needed you before openAI. It's still a helpful perspective I must say.
Cancel this guy he’s spitting facts! The interviewees will revolt
Re 3:05 transforming multiplication to an addition problem is called logarithms. From the tables 55 = e^4.007 and 32 = e^3.466. So, e^4.007*e^3.466 = e^7.473 an looking back at our tables e^7.433 = 1760 rounded to our 4 digit accuracy.
2:00 Seriously I didn't know the mechanics of why the method works, thanks for explaining
Totally agree, I realized it was better to cheat and look at the solution if i couldn't figure it out by myself in 20 or 30 minutes. Looking at the solution gave a complete new insight
- Just learn core algorithms
Dynamic programming says hello 😂
dfs,binarary search core algo, sliding window technique
Finally someone! Thank you!
It was very comforting to see the math example compared to algorithm
I believe they make these interviews brutal to stop programmer mobility. Lowering programmer mobility reduces industry salaries.
Basically how we learn college level maths anyways. Unless you're an acamedic/researcher, people just grind math problems by looking at the correct solutions when they fail
after seeing the thumbnail i thought its a fireship video
ikr lol
I just had this same thought, and damn, Neetcode himself lays it down in a video.
Leetcode is not strictly an intelligence test, it's a memorization and pattern recognition test.
Hell, looking at modern machine learning algorithms (which are frickin' good at leetcode), perhaps that's all intelligence is?
1:17
NeetCode: "I know what you're thinking"
Me: "let him cook!! 😂 "
great video !
Basically try not to make the model underfit by expecting to learn by thinking. Take the training data and learn. You'll feel dumb but remember you're getting better eventually. Eventually this will become a habit and you'll see patterns in problems you had no idea about at first.
This is the first time I saw your face. Thank you for this explanation and the concept.
Not only that but the integral problem I’m seeing with LeetCode is its deviation from real-life programming (in relation to most of the tech field positions). Naturally improving at LeetCode also means improving as a programmer, but what’s interesting to see is how little it applies to the job market.
This is true. Some algorithms are a result of PhD research and there’s tagged “hard” on leetcode where candidates are expected to solve under 20 mins in interview setting. Ridiculous.
Unless you’ve devoted time to solve the same variations and have memorised the algorithm it’s impossible in an interview setting to anywhere get close to even making past 20% of test cases.
Oh, and there’s tons of such problems.!
Yapper.
He turned from a soothing voice to a fortnight streamer's ad voice.
The beginning of the video is how math should be taught so that it would make sense instead of it being this abstract thing.
The reason I like leetcode is that there are a shitload of (to me) novel problems. Usually I think of the naive solution, then look up the optimal solution. That's how you learn. You think then you improve
Actually this is a brilliant observation.
It's honest.
Make sure you understand the problem.
memorize the fundamentals only.
the rest is connecting the dots.
THIS IS THE WAY
And the multiplication they taught us as kids is the absolutely the worst way to do it. It is tough to do it in your head. But then, teachers will always want to "see your work", so they choose this obtuse way to do it. I simply just factor the numbers in my head and recombine the primes to get to the answer. Or, I just whip out the calculator.
Leet Code is a joke. Most of them I can do very easily. The problem I have with Leet Code is that they are timed, which takes all the fun out. In the real world, you typically have a lot more time to solve problems than just a few minutes.
For instance, I had a multilateration problem to solve once, and I could not find any off the shelf solutions that worked. Most only involved 2 or 3 nodes. I had to solve it for many nodes detecting the BLE beacons that were to be used to track the location of pallets on the factory floor. Took me 2 or 3 days, but I did it.
I've been saying this since CP wasn't even main stream!
I was thinking leetcode is just partially understanding + some memorization before I opened this video and this guy said exactly what I had in mind❤ 4:19
the grade school math example is extremely apt; asking senior/staff level candidates to remember things from school (20-40 years ago) and then equating that with “problem solving skills” is exactly whats wrong with leetcode
I realized this after completed a few dozens of problems. All them already had efficient solutions, and"my" solutions will not bet them (at least in efficiency). It's not because I'm not smart enough, but because all of them required different mindset, and different experience. I also notice that all efficient solutions of different problems was in invented by different people, doesn't it looks interesting?
To summarize, don't reinvent the wheel. Your goal is to learn how to ride it.
How hard is drawing the line for myself to say "ok, enough push through, let's study the known solution and see what could be learned from here"
i feel like we are becoming like LLMs ourselves. just retrieving the answer from the knowledge base without actually having logics.
I’m grinding easies until I can do them in my sleep. Very effective
I agree because unless you are hired for research under a reputed research organization, you shouldn't care how multiplication works. In the interviews, you always JUST need to know the multiplication trick.
The more neural connections you have, the higher the chances that forming new ones will not take much time and effort. When I was studying computer science, my classmates did not understand and were surprised how I could remember several pages of text after reading it once and could then successfully pass exams. I tried to explain to them that I studied at a good school, where from the first grade we were forced to memorize a page of text every week, and at the end of the year we had to recite all the pages that we had learned. With this approach, connections are gradually developed that allow you to understand everything very quickly in the future. But this must be done in childhood. This trick will be much more difficult for adults to do. Learn things by heart. Don't listen to those who say otherwise. First comes quantity, and then it turns into quality. The most important philosophical principle.
Thanks bro for such beautiful piece of content... From last to years I am banging my head against wall(you know what I mean) but can't solve questions on my own... Now some questions can be solved... Your intersection approach (in this video) is what I was desperately searching for. Thanks a lot a lot alot brother 😅😅
Man this is it, thank you.
that multiplication explenation was awesome.
Thanks for your resources. I appreciate it.