I Solved 1583 Leetcode Questions Here's What I Learned

626.05k views4013 WordsCopy TextShare
ThePrimeTime
Recorded live on twitch, GET IN https://twitch.tv/ThePrimeagen Reviewed video: https://www.youtub...
Video Transcript:
so apparently this guy solved eight 1583 leite code questions when I was in college I was very struggling with programming I tried code forces Cod and even read dragging the coding interview I never felt ready for interviews I knew I needed to get better but I didn't know how by the way a really great method to get better is uh you're kind of worried about interviews you feel like you're not prepared for interviews go and interview at places you don't care about start applying to companies you would never work at just to practice by practicing
and a you could find out maybe you do actually want to work at that company like that's the best part is a you could discover something you're really interested in doing and B you could also you also just get that practice you know there's no amount of leak code you can ever do that's going to make you feel comfortable standing up in front of a whiteboard for the first time there there is no amount of pre-practice there's no amount of pre-at there's no amount of anything to get to that point you just got to stand
in front of a whiteboard to be comfortable standing in front of a whiteboard CH in 2017 when I came across lead code I instantly fell in love with its clean and userfriendly interface and more importantly the problems were actually relevant to the real world interviews it not only helped me improve my coding and problem solving abilities but also helped me read coding interviews at Big tech companies like Amazon Google and Microsoft in the past shambles right now I'm literally in shambles I'm literally in shambles right now okay they could have yeah don't just don't even
say it don't even say Wy in shambles okay um they took they took the end out of fang he just did right there hurts me few years I worked for more than 1500 lead quod problems mainly because I didn't have anything else to do and I feel really excited whenever my okay it feels a little bad I mean uh so what why did I do the ball I had nothing else to do so I just built lead code problems were accepted even for the easy problems I thought more problems I solve the bitter are my
chances of cracking interviews however that was Far From Reality you don't need to solve these many problems in this video I will talk about three mistakes I made and the lessons I learned so that you don't fall into the same traps and increase by the way you should do some of them so I don't know what he's going to say I'm curious what his three mistakes and what you what you should do like once you've once you're past like 1500 is so aggressive but just knowing some of the likely handshakes that you're going to be
asked like minimum subarray having that one in your tuck is just so good right because you know for a fact I've been asked that two separate times two separate times right it's crazy how many times I get asked the same interview uh questions you know what I mean your chances of interviews my first mistake not understanding fundamentals for some of the topics I directly jump into solving problems without understanding how it works this is a big mistake before you dve into lead code make sure you have a basic understanding of fundamental data structures and algorithm
for example know how to implement basic binary s algorithms if you don't how to do binary search off the rip you're a loser okay I'm just throwing that out there right now okay Step It Up step it up it's simple you should know it you should just know how to do it it is easy oh it's a tree you should know how to do a binary search on a tree if it's an array you should just know how to do a binary search and you should not get mixed up on where you do the plus
one it's just you just think through it it's simple it's obvious it's easy I'm sorry for being so mean to you guys but sometimes you guys need that Stern reprimanding okay wait hold on whoa timeout time out time the the hell out did I just say binary search and you hit me with an easy array do sort fired get him out get him out get him out get the guy out just Dr got it binary search easy boom ra on sword dates likees linklist Stacks Q okay you I I mean this guy's editing is obviously
really intense like he really does a lot of editing but reting them all is just giving me an actual seure hmap binary PR articles grabs and no algorithms like salting binary search 3D algorithm recurs and dynamic programming DFS and BFS you don't need to study any advanced data structures in the beginning okay first off AVL trees are pretty cool if you don't know AVL trees you're also also loser okay avls are freaking awesome okay by the way this is not a proper AVL tree just so you know no we don't no never mind this is
fine this is fine AVL tree it's is it a fine AP L tree yeah I think it is in the beginning for two reasons first they will eat a lot of your time and second they really ask in the interview you can use websites like Geeks for geeks or watch first off never use geek for geeks that website is just trash I hate that website I hate that website like you look up anything AVL tree okay and it shows up geek for geeks watch this where is the geek for geeks you hit that and what
do you first get boom you're going to get hit right away with hey come on man get that b blocker off so you say continue without support crying face and then it hits you with another thing and so then you exit that and then sometimes it'll also show your email address and it will also do this and it will also do that and wait a second rewind here rewind rewind I got to rewind here first they will eat up a lot of your time and second we're rewinding and bf you don't need to study any
Advanced Data 12854 12854 yo don't don't take someone else's diagram you got to at least change it a little bit man okay you got to at least change it just like a just like a little bit just a little bit okay just like a tiny just a tiny okay I mean your point have been made your points been made okay but stres in the beginning for two reasons first they will eat up a lot of your time and second they really ask in the interview you can use websites like Geeks for geks or watch tutorials
on YouTube to learn basic fundamentals you will find by the way I do have that free algorithms course I'll link it in the description not a big deal NBD NBD NBD people it's free it's N9 and a half hours long and if you never sign up for front and Masters I get paid zero cents so don't worry I'm Shilling it for free for freezy freezy easy peasy pumpkin sey links to my favorite resources there's no way he remembers put Des problem lead code problems come in three players easy medium and hard some folks say you
only need to solve 75 or 100 I only do hard because that's the state I'm in problems but honestly it depends on your coding experience but in general I would say around 300 high quality problems is a good number if you are a new be like I was in the beginning you need to solve more problems if you're new to a topic start with easy problems and gradually move towards medium and hard problems it's like learning to walk before you run here is my secret sauce out of all the problems you solve make it 50
one uh by the way every now and then on Le code you'll get like an easy problem or a medium problem that definitely should have been a hard problem like a toi a toi there's so many little damn Edge conditions my goodness it is just the worst I want that secret sauce though 50% medium do you guys agree with that honestly if I were you and you were me I would do a good data structure and algorithms course understand all the fundamentals maybe do 50 leak code problems easy and medium targeting array style ones because
honestly array ones are going to be your hardest and they're pretty common within it have a touch of DP experience and then go for the interviews I think honestly failing three interviews is no different than doing a thousand leak code questions because you learn what people are asking DP stands for dynamic programming you losers okay okay this ain't hentai over here this is programming get your in order medium 30% easy and 20% hard if you're solt on time in looking for a curated ntop problems I highly recommend solving lead quod top interview question and 100
most like questions so how to go about solving a problem first try to understand the problem write it on a paper visualize it in your head run through a few input and output examples think and write your Solution on paper after you think your solution will work run it on lead code and compare your performance with others the last part comparing your performance with others I'd completely ignore that last part it is utterly insane how they do performance you literally can just you run the same solution three times and you can go from 100% to
0% like instant instantaneously um second off you should always have paper come on dog look at this I got paper and pencils right here drawing stuff and thinking is a very good way to go about stuff thirdly uh I would actually treat it like an interview if you really wanted the practice get an effing whiteboard out right do the problem and actually try to solve it talk out loud do all of that stuff put it on a whiteboard and see if you can directly put it into leak code and see if it actually um if
it actually does uh if it actually if it actually even compiles if it even works okay show us what's on the paper yeah yeah yeah yeah yeah here you go uh this one is um my time my timings for when I do the oh gosh I can't make it this is the timings for when I do the algorithm course that I have to have down in my head just in case I forget the graph I want to use for prims and csal here's a great graph to be able to show some pretty cool Parts especially
with disjoint sets and path compression uh planned it out planned it out dog uh lastly here's maximum flow Min cut here's the graph I want to use so such that I will be able to do an augmented path of purely only using positives and then showing how you can actually use the negative backtracks to still continue to do augmenting paths so I have two good two good graphs there or uh two good ones and some notes you know kind of like how you want to be able to kind of teach these things so anyways there
you go nice balls you're welcome Bud weird flex but okay yeah it's the life I live I do look at I do I do regularly study algorithms algorithms follow Gooding prac believe me naming aable ey during your interview is not going to win you any points on the contrary it can actually harm you if you don't follow go to quing practices during the interview don't too much time on is that true is that true as an interviewer as someone who's done way too many interviews do I really care how you program on a whiteboard nah
for me the bigger thing is just that you just talk through what you're thinking I do like seeing you solve the problem even if you solve it wrong I still like seeing you attempting to solve it I think that might be true for a junior position I mean for a junior position I just assume whatever code they put into the into the code base is going to be anyways and we have to like help them right so why would why would you ever assume that someone's going to be a good like especially a junior in
fact I would be more concerned for a senior if a senior walks in and is just like making addendums all over the place and it's just wild then I go wow they really did not pre-plan this at all in their head they fully just went full stream brain and just started ejaculating code and they got it wrong right to me that'd be more a single problem if you're un to solve the problem within an hour then look at the hints and the solutions go to the discuss section and see like what other solution people have
posted this brings me to the second mistake that I made not utilizing lead code discuss section in the initial days after solving a problem I moved on to the next one hoping that I have submitted an optimal solution and it's good enough for interviews but that was a huge mistake really after you tackle a problem read the official need quod solution go to the discuss section and try to understand top Ed Solutions you can even contribute your own solution if you think Your solution is unique stay organized if that's I mean that's actually pretty good
advice I I could see that seeing how someone else solved it can always help you like there's little things that you can do that just make solving it especially on a whiteboard much much easier uh honestly it can make life really really it there's a lot of things that are pretty good why did he pick Java to trigger all of us with light theme light themed Java that was just he was there to this guy chose violence he woke up and chose violence you really want to get the most out of lead code is staying
organized this key for that I recommend uh junior control copy from stack Overflow seniors over complicate things you know I'm not going to lie to you I hate this take real talk if you're I know you probably are just doing it as a joke but I'm I'm leaning in okay we're leaning in everybody get your get get your jackets off okay we're going all in on this one stay a little bit um is it the opposite no if your job can be boiled down to copying and pasting from stack Overflow you are literally replaceable by
an AI okay stop stop your job is more than that don't make I I I hate that joke because it is so stupid I don't I haven't been on stack Overflow in like two years other than trying to ask dick questions like I don't go to stack Overflow pretty much ever to find things and anytime I do I'm almost exclusively disappointed by whatever they're showing you come on people the only time stack Overflow actually works out is because you don't know the API of JavaScript and you look up some simple question how do I see
if one string starts with a a sequence of characters and it goes off and goes stack Overflow how do I tell if one and it just works okay yeah Prime uses geek for geeks obviously I use geek for geeks um that was please if you're watching this in the future and you didn't have the context that's a lie but real talk you just simply like you actually probably install left pad from stack Overflow like that's the thing you got to understand is that you use stack Overflow because you don't know the apis and if you
keep looking up the same stuff over and over again that's a u problem fix the U problem okay just fix it stack Overflow where pedants go for validation their pedantry knows no bounds skill issue you literally got to fix the skill issue you are living a life of skill issue fix that loving a system When I Was preparing for interviews I utiliz nosan to create a list of problems with their links difficulty levels status and notes if I couldn't solve a problem in one attempt I would change the status to revise so that I can
come back to it later I ALS that's pretty good I mean I think there's a lot of wisdom in this that you should really try to keep track of your progress but I would say that the one downside to this is that uh you are also keeping track of everything you're doing which is a lot of busy work right there is a lot of effort you have to put into this um would I use obsidian nah would I use notion no I kind of know what I'm good at and I kind of know what I'm
bad at uh prob this is just not really for me also shocking is that there's this incredible level of detail right here and then doesn't even name the section okay hits them with the Untitled did the camera die F I'm going to turn this on for a moment it'll probably overheat pretty quickly but we don't have very much left okay all right let's go let's go link all the useful articles from the lead Cod discuss section on the Bas with my person provided in the description which I use during my own preparation feel free to
duplicate it and add your own problems according to your needs so now let me talk about the last mistake that I made not doing lead code contest for the first few years I ignore lead quod contest and only focused on solving problems whenever I felt like it but it was a bad idea and after realizing it I started doing contest regularly during my preparation I strongly advise participating in lead code contest and also virtual contest if you happen to miss any because it helps you practice in a timed environment after you have solved enough problem
and gain confidence you start timing yourself during your practice sessions this will help you maintain focus and prepare you under time constraint which is how the actual interview happens so honestly that's that's not terrible advice that's you can use a timer you don't have to do contest but I think contests really help you put it puts yourself in the zone you know what I mean because when you put a timer up you don't have to compete against anything but when you're in a competition it forces that same feeling it's actually not it's it's truly not
a bad idea I I really appreciate that perspective I think that that was a really well done perspective absolutely this guy's cooking this guy's cooking harder than my camera I like this I do prepare how can you tell if you're ready for the interview if you can consistently solve lead code medium problems within 25 minutes and three out of four problems in the lead code contest you are in a good spot for most coding interviews remember it's not about how many problems you solve it's about how good you solving any new problem that's why lead
Cod cont are very useful because they help youate where you are in your interview preparation Journey so do you need any other platform apart from lead code for practicing questions in my experience the answer is no and don't rust to get lead code premium to start with 200 to 300 problems and then decide if you really need it one good use of code premium is when you want to solve company wise problem but that is not needed in the beginning I hope it was useful you can find all the links Below in the description if
you have any questions or you want me to make a list of my favorite Le Cod problems let me know in the comment section I wish you good luck for your interviews bye-bye uh I like that that was actually really good that was a very good video Ashish I appreciate that I'm hitting you with the sub hitting you with the sub press that thumbs up um actually really I really liked what he had to say he had a lot of really good little bits of wisdom that I think you forget when you've been out of
the industry for so or when you've been in the industry for so long you forget that one side uh there's a couple things I think he did really well the timing of the problems I think is a really good is a really good practice because you really want that forced stressful environment because when you stand in front of a whiteboard you got a timer and not only do you got a timer you got somebody watching but the thing that he did not do uh well which is emphasize other skills that are useful and interesting the
thing is is when you come in and you're literally just like a finite automata of just leak code you're not interesting okay there's 10,000 people just like that invest in an open source that seems interesting to you try to get three commits in something that's really really good right go look at neovim and try to get three four five commits uh I always think of TJ which is like TJ is now a core maintainer and he's just done an amazing amazing job of going from not knowing even what git is to becoming a core maintainer
of neovim and now he's had a lot of success finding jobs he's working a great job at uh at source graph he's doing language server stuff like he picked a technology got good at it and it was leverag for him to work somewhere else that's also a really really amazing thing to do and you should consider that too because once you also do that you will start working with teams you'll start working in a professional code base you will start working with other people that code differently than you and you will learn how to work
work in a team you will learn how to communicate better you'll develop all the soft skills that you need it's a really good approach to life um and so I really think that that is just like a huge thing that he did not cover and I'd really uh want to you know kind of push on that hold on one second sorry we got a poopy diaper okay I was informed that there's poop in a diaper and I it might be mine it might actually be mine okay anyways this is very very good hey the name
so I like that this is good advice right here okay a Jen
Copyright © 2024. Made with ♥ in London by YTScribe.com