5 common LeetCode mistakes with Coding Interview Prep - Java Brains

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so websites like hacker rank and lead code are great for practicing for coding interviews but if you're using those platforms there are a bunch of mistakes that you could make seeing people make these mistakes that I want to caution you about so make sure you're aware of those possible mistakes and pitfalls and you can plan for it so in this video I'm gonna share with you five common mistakes that people tend to make and how you can avoid them and why you should avoid them when you're using sites like hacker and lead code for practicing recording interview [Music] so first of all let me clarify that I think these websites are great right hacker encore lead Colonel that stuff they actually have brought about this concept of competitive programming they almost treat coding as a sport right if you have multiple people playing the coding sport and getting better at it I think that's awesome and one of the side effects of this becoming popular is that these kind of questions tend to get asked a lot in interviews and people also use these platforms to practice for coding interviews and get better at coding which is perfectly fine perfectly legit but because these sites likely could lead code and hacker ID are built with a different purpose there are a few areas where they don't quite align with your preparation for coding interviews I'm gonna highlight a bunch of those misalignments and possible pitfalls that you make and have you can solve for them right so let's start with the phone number one for mistake number one when you do a coding challenge on leet code you will be given a problem you can read through it you will be given examples of the problem you will be given sample test cases what are the test cases you might have to think about and what is the expected result and more details about the problem right so you can read through the whole thing before you start the problem this let me assure you is very very very different from a typical coding interview in a coding interview somebody were to give you a problem they start with one sentence for possibly two sentences they give you just the basic information they are not gonna share the details and this is intentionally so a good interviewer starts with just the basic question and they expect the interviewee to ask questions okay all the information is almost definitely not given to you right you are expected to identify what those missing informations are and then ask the interviewer notice this is very different from lead code where everything is given to you so this actually ends up being a little bit of a problem in using leak code for practicing for in a couple of ways first when you look at the leaf core problem since everything is handed to you you're not really tuning that part of your brain where you're examining the problem trying to find out those gaps and asking questions you're not practicing for that right it's the first problem and the second problem that this causes is because you might have seen a problem on leap code when an interviewer asks you the same question all right they ask you something you've suddenly got a hundred times and they don't give you all the details and they expect you to ask questions if you were to say hey I know this problem I've seen this in lead codes I already have all the answers that's gonna work in your disadvantage because here's the entry you're expecting you to ask the questions and you have made a bunch of assumptions because you saw a similar problem on leap code okay those two problems are caused because likud kind of gives you all those details so here's what I would recommend first when you're tackling problems and leak code start with just the first sentence or a first couple of sentences so that you kind of get a sense for what the problem is but don't read through the whole problem okay assume that this is an interviewer who's sitting in front of you and asking that question don't read through the whole problem and try and tackle this but the limited knowledge does those first two sentences give you okay and in the process you will uncover then okay there's some information missing all right make a list of those questions all right either in your mind or write it down or whatever make a list of those questions and then read through the problem and see what one of those which of those questions are actually answered very likely the questions that you have made would probably be answered there and you get more information you kind of practicing asking questions after an interview ask your question or you might discover some details which you hadn't thought of asking in which case again it's going to be practicing your questions like hey this is something that I should have asked so Vincent then somebody asked me a question like this in an interview I need to make sure I clarified this okay so this is very important this typically happens in interviews you are expected to ask clarifying questions expected to identify what's the missing information that the interviewer hasn't given you when they start out with the problem okay so first of all don't read through the whole equal problem right read a little bit try and ask questions before you get into the details and second remember what the interviewer asks you no actual interview might not be the exactly good question that you might have solved right even if it is it doesn't matter you ask those terrifying questions so that you get that information out of the interview but for number two when you're writing code using lead code it verifies for accuracy it verifies for you trying to solve the problem if you successfully solved the problem or not right it's a machine trying to verify your code so you can write anything you want you can structure your code hover over you one as long as it solves the problem accurately you're done but in an interview when you're by boarding guard when you're writing a coding interview and you're trying to solve a problem accuracy is one of the several things that in two year will test you right it is not enough the Accord is just accurate a bunch of other things that you have to think about is your code readable is your code something that the interviewer can understand are you using proper feasible namings right I don't use IJ KABC we lose every bet you can do that in lico a little work but if you do that in front of an interviewer and expedience interfere that's gonna take points away from you right you need to write sensible variable names okay I've seen this happen so many times in all the interview solutions that I see online right you have all these different forums where people say hey I got asked the same question in an interview here is my solution and that solution looks like a mathematical formula has no idea what that person is doing okay so that kind of a solution while it might be accurate and while that would work in a leap code setting that will not work in an actual interview setting okay so even though you're practicing on lead code and the algorithm on leap code won't know the difference make sure you're naming your variables right make sure you're making your code readable if you have like an expression inside an if condition you use that expression a bunch of times give it a proper variable name don't like to make a terse okay don't try to save lines I've also seen people say hey my solution takes only two lines that's great for competitive programming but that's not true and that's not gonna be beneficial for you in an interview setting you want to make sure your code is readable third mistake and a third difference between an interview setting and a leak code setting in a lead code setting you click the submit button just once okay you've done with your coding nobody cares what you do in the process when you're coding but when you're done you click the submit button just once and that's when you are evaluated you're evaluated on your final output and imagine pretty much not the case in an interview setting in an interview setting you're not evaluated for the final output you are evaluated for the opposite you are evaluated for the process that you took to get to that output okay so this makes a lot of differences in how you approach things first you need to know how to speak out loud think aloud is what people say in an interview setting and that's very true and that's not something you would do when you practicing in lico okay so that's something I would recommend in your writing code and lead code imagine that there is somebody sitting next to you explain to them what you're doing while you're tapping your code okay that's that's a perfectly legitimate ik you know practice mechanism for practice for an actual interview but this is something you should do right when you're in an interview don't just jump into writing your code I talked about asking questions but then you also have to verbalize your process and talk it through okay so don't think that you're solving lead code you're not evaluated for the final output you're evaluated for the process [Music] difference number four and kind of a pitfall because of leak code as well I have seen people who solve problems on lead code compare their person ages percentage are how fast their program lengths how much memory it took there's something lee code that's right when you submit a solution to a problem it tells you your program your solution was five percent faster than like so much percentile right your your program was in the top five percent your memory consumption was in the top ten percent it tells you that and this is seductive you want to score more it kind of appeals to you it makes it competitive and I get there pay for that and it's super fun to do this super fun to tweak your program and make it score more in that scoring but that's again not something people would care about in an interview setting okay in an interview setting people don't care if your program ran five percent faster than all the other people who submitted their solution to that same question right they won't even know okay so what you need to do when an interview setting is look at the time complexity okay is your program running at OFN of n square of log n time complexity is what matters the interviewer is gonna expect you to reason about this the Interior is gonna expect you to know what the time complexity of your solution is but this your solution run five percent faster nobody cares okay don't bother about it this is something that you kind of sweat or in lead code right people kind of think about this a lot in the code but don't do that an entry setting it of course doesn't make sense in an interview setting so if you're using leak code to prepare for an interview don't care about those things worried about the time complexity and forget about everything else it's it's the readability of your code that matters more and the your code running by person faster [Music] make sure you're practicing on the whiteboard delete code allows you to type out code this may not be what you would do in an interview in most interviews favor whiteboard because it's you know it's a group setting people are people can look at the whiteboard and interviewers can ask questions that kind of stuff so typically coding interview is a whiteboard interview so not only do you need to know how to solve the problem you also need to be able to write it on the whiteboard and if you have been just practicing on the keyboard on lead code it's gonna be a little bit of a challenge to kind of translate that into a whiteboard setting okay it's you tuned to typing the code you're not practicing your writing so I would also encourage you to practice writing your code on a piece of paper right you don't have to use a whiteboard just take a book and a pen and then starting your code there are a bunch of other things that we could provide I think this is enly code premium which allows you to see auto completion right you can press a dot and then it shows you method names or we remember vehicle names and all that stuff that can won't help you in an interview setting right you don't get out of completion on a whiteboard so again I would recommend you to avoid all those things thankfully the order completion thing is a premium at least for now so you don't get to benefit from that if you're just using a free account anyway but if you're using a premium account don't use it I don't get used to auto completion we all get you start a competition in an ID and that's the reason why interviews are a challenge so if you have to practice for an interview let go of auto completion let go of things like syntax highlighting even practice on a simple editor with are all those fancy stuff or practice on pen and paper okay that's gonna be your best bet learn how to tackle those same problems in an interview setting after you've done that you can probably translate that code into leet code type that out and then see if it's accurate but then your thinking process has to be tuned to be able to do that on whiteboard or on pen and paper I'm going to leave one final tip which is kind of an obvious thing but I want to say that anyway Lee code is about programming and programming only but when you are in an interview with a person talking to a person there are a lot of other things at play it's not just about your coding skills it's also about how you talk of you communicate how you are listening right listening is also another thing which is not focused upon it's not just have you talked it's also about have you listen have you ask questions of you're receptive to hints receptive to criticism and all that stuff those actually matter equally almost as much as your coding skills so those are things that you wouldn't get on lead code so these are the five tips plus a bonus step about doing coding interview practice on lead code and what are the things you need to watch out for because Lee code isn't a coding interview and how things are different now we can plan for them I hope you found this video helpful [Music]
Info
Channel: Java Brains
Views: 74,031
Rating: 4.9318266 out of 5
Keywords: java, java brains, tutorial, brains, koushik, kaushik, brainbytes, explained, java tutorial, learn java, java tutorial for beginners, java programming tutorial, java programming, java programming for beginners, programming, koushik kothagal, beginner, java training, interview, leetcode, hackerrank, coding interview, tips
Id: Rv2aqJVRwaM
Channel Id: undefined
Length: 14min 50sec (890 seconds)
Published: Sat May 02 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.