How to prepare for coding interviews using Leetcode? Why Leetcode is the best

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys hope you're doing good today in this video I'm going to talk about lethal what is lead code and how to make best use of lead code and why lead code is one of the best resource out there to prepare for coding interviews especially if you are preparing for companies like Google Facebook Linkedin or Amazon etc I'll explain some strategies tips and tricks that work for me when I was preparing for interviews based on my experience I am going to give some insights into like what works best for me so that it's helpful for others who are in the same situation but what is lead code if you are preparing for interviews you may already know this but let me explain the lead code is a website that has a rich collection of interview questions especially the algorithms and data structure problems which are asked in the coding interviews usually companies have two to four rounds of coding exercises starting with the telephonic screening which is again a coding interview so you like it or not you have to go through this coding interviews especially if you are serious about working for one of these companies I'm not getting me to the discussion of whether coding interviews are meaningless or does it determine if a candidate is good or not that's a huge debate in itself like even I'm not sure if that is the right approach so what makes leet code really affect you and stand out from other websites out there is the problems in the database are actually asked in the interviews and also the problems are not just interview question but each question has well crafted set of test cases so most of the questions have like 300 400 test cases also lead code has a code editor where you can select your language and type your code right there and also execute it and test your code against all the test cases so this will help you not only practice solving the problem but also think about all the possible edge cases and more than question themselves these test cases are what makes leet code really strong so who prepares these questions and who comes up with these test cases it's the people like you and me so the questions in the lead code are actually questions asked in the interviews so people after taking the interview they come here and they submit the questions so when it comes to getting better at solving these problems the key is practice so when you have given a problem to solve in to you so your brain works in two modes so either you try to recall the solution that is to remember the code so other mode is problem-solving mode where your brain just tries to solve the problem using the tools and techniques that it knows it tries to identify and break the problem and solve the problem so the first approach of trying to recall our memorize the solution always leads to disaster because if you try to recall the solutions or remember the solutions you can only solve problems that you have seen already so in leet code itself there are like thousand four hundred questions so it's impossible to memorize solutions to all these problems so but the good news is you don't have to memorize this solution so the idea is to train your brain for problem solving and just like any other skill you get better at it with more and more practice and and I think like lead code is the best place to train these skills so how do you practice and what to practice so in leap code the problems are very well organized along with questions details and test cases there is like lot of other meta data for example it has all the list of all the companies in which this particular question has been asked and also what are the related topics so in lead code the problems are organized based on difficulty level whether it is an easy medium or hard related topics such as arrays dynamic programming trees hash table DFS BFS and most importantly based on company for example all the questions asked in Google this is the most important feature more important anything so let's first talk about the difficulty level so in late code there is like three difficulty level easy medium and hard first one is easy so these are the problems I call warm-up problems so they mainly test your basic programming and data structure skills they are mostly straightforward for example parsing sorting searching in a hash map these sort of basic techniques I love this kind of problems because they help you improve your coding speed so just because they are easy doesn't mean that they're not as asked in the interviews so you need to take these problems very seriously so most of the telephone explained questions are easy level problems from what I have seen and if you can't get past the telephone that's the end of the interview game so these are also asked in on-site as quick hitters which means you are expected to solve these questions fairly easily so that interviewers will move on to the harder question so you need to take this seriously and solve these easy questions as much as possible so also these questions will teach you the basic building blocks which you will use in the medium level questions so now let's talk about the medium level questions so these are the most important problems in your into preparation period 85 to 90 percent of the problem asked in the interviews are going to be medium level problems so they are a little bit involved than easy problems you need to know the techniques such as backtracking graphs memorization dynamic programming two-pointer approach breadth first search depth first search etc but you can learn a lot of useful techniques by spending time on this medium problems now let's talk about hard questions so if you are not able to solve these hard questions don't feel bad there is a reason they are classified as hard problem usually interviewers are told not to ask these hard questions even for senior engineering positions but that doesn't mean that hard questions are not passed in the interviews so the reason is it's always a hit or miss in one are it's not reasonable amount of time to solve these problems if we have not seen this problem already and also it makes it harder for the hiring decision makers to decide if the candidate was bad or he just got unlucky with this problem very few companies encourage these kind of problems like Google Facebook can be snapchat etc so I'll give some more data on that later so does that mean that we can skip these problems altogether for most companies yes so the best strategy is double down your effort on easy and medium problems and only when you're feeling confident about your skills in the easy and medium problems then you attempt the hard questions and and do not feel bad that you can't solve these problems because most of us cannot so this is the breakdown of problems in late code and if you look at the percentages 51 percent of the questions in late code are medium questions and around 30 percent of the questions are easy questions only 21% is hard questions so this is rounded off percentage so it may be off by one but as you can see the easy and medium problems makes up about like 80% of all the problems in late code and hard problem is makes up for only 20% of the problems so now let's talk about strategy where do you start right so one thing I want to talk about is the topic of building the confidence so one important issue that we need to be aware and address is confidence level and morale solving these problems are not fun it drains your energy just like working out in a gym you can only do like so much after that you will get tired when you're solving problems you are using brain so you will feel stressed out and when you feel stressed out you get frustrated that you are not able to solve the problem and you get demotivated you feel like you're not good enough good at this or not cut out for companies like this that's very common but think of it this way so if you starting to work out in a gym do straightaway go and do deadlifts with like 300 pounds of weights so you will just kill yourself right and not go to gym anymore you have to think of problem-solving in the same way the good news is anyone can get better at solving problems and anyone can crack these coding interviews with enough practice and building confidence the key is to not give up over time you will build confidence and that is the most important thing which is needed to crack this interviews so what's the strategy here to Train you need to start with easy problems at first even easy problems will take some time to finish don't worry you will only get better at it so if you are beginner don't even like look at medium or hard problems for now one of the reason that I like easy questions is it boosts your confidence and morale when you feel confident about easy questions when you are able to do it easily with like less time and less friction you will build some confidence and till then just stick to easy questions and once you feel confident that you can do easy questions and you are like feeling powerful like building and everything then go to the medium questions and let me remind you that like when you start doing these medium problems you will feel demotivated again like instantly so your brain tricks you into thinking you're not good enough you can't solve this exit rap so your brain just tries to avoid solving these problems and feeling uncomfortable but if you are really serious about this then you have no other choice you have to keep at it even if you feel uncomfortable until you start feeling comfortable with it again stick to medium don't even think about heart so when you pick up a medium difficulty level problem so what you have to do is attack the problem and fight with it until you solve it for all the questions in lead code there are solutions available either on the internet or in the lead code itself so there is also a discussion forum and solution section but the key is to avoid looking at these solutions so you have to fight with the problem you have to try to solve this problem until you have exhausted all the options so the reason is you can only train your brain efficiently if you try to solve it by yourself so the minute you give up and try to look at the problem then you are just memorizing it which means putting your brain in a different mode not the problem-solving mode but set a fix at time maybe two hours or three hours per problem and if you are not able to solve it then you can look at the solution solve this problems on pen and paper you have to go to the basics which is like just take a pen and paper and fight with problem and struggle with the problem so this struggle is what teaches you a lot of things all the coding interviews are on the whiteboard you have to learn how to write the code without the help of any IDE so when you write it down so you can actually translate your ideas and thoughts about the problem in real time on the notebook will help you organize your thought process so when you fight with these problems there are some important things that you learn one is how to take the test input right so for any problem you have to come up with a test input which tests some of the different scenarios so this particular skill is going to be the most useful in the interviews so as an interviewer I usually get very impressed with people if they come up with good sample input and list out some of the edge cases so also the other important point is as soon as you see a problem like problem or easy problem try to find the brute force solution for it and then optimize it for every problem first thing you have to do is figure out what is the brute force approach will be for this problem it's usually like easier to find than the optimized solutions even in the interviews your 50% done if you can come up with a brute force approach a working approach and then try to find optimal solution because most of the time candidates fail to give an answer because they instantly try to find an optimal solution and brute force solution is better than no solution right most of the times as a candidate we feel that if we tell the brute force solution we'll be judged as a bad candidate and we put unnecessary pressure on ourselves to like find the best solution right away but that's not the case it's the opposite interviewers want you to think about the brute force approach tell that approach and then go and find the better solution optimize it see where the inefficiency is now comes to the heart problem so when you are going to solve the heart problems start with an expectation that most of these problems does not have a correlation with what you have learned so far these hard problems are like specialized problems which people like took years to solve so don't expect to like solve it within one R if you have not seen it so if you are not able to solve it off you're trying for some time you're not alone so these problems especially makes you feel really bad about yourself they are very demoralizing so do not just keep trying to get better at heart problems you can get better at like solving easy and media problems but heart problems you don't usually get better at heart problems so do one or two problems and get back to the easy and median problems so you will feel better I was very curious about like these heart problems so I did some meta analysis of which companies asked these kind of like hard questions and how important is it for the companies so this is a graph that I came up with from the data available in the lead code what this graph is showing is for each of the company what is the breakdown of questions like what what percentage of questions are hard problems what percentage of questions are medium problems and what percentage is easy problem so I have order them in descending order of percentage of heart problems interest for some reason 42 percent of their questions are hard questions again this data has been created from the information available in the lead code from what I have heard also that like Pinterest snapchat Airbnb are like the hardest interviews to crack so I walked in here bin B and I can attest that like yes that's true but the good news is apart from these companies other companies are fairly reasonable so for example Google has twin around like 23% of the questions are hard questions around like 80% is still easy and medium problem Facebook for example they only ask around like 17% of their questions are hard level questions so these are just like the companies which ask the most amount of hard questions and rest of the companies as you can see around 15% or less a number of hard questions so as I said like 85% of your effort should be in solving getting better at easy and medium problems so don't be in an illusion that all these companies just ask hard questions hard level questions that's not true so you can double down your efforts on easy and medium problems so now let's talk about the topics so once you start solving more and more easy and medium problems so you will see that most of the medium and easy problems follow few patterns so most of the problems can be solved using few set of techniques it can be algorithms such as sorting backtracking binary search - pointer 3-pointer approach or it can be solved using one of the data structures like hash map priority queues graphs trees depth for search breadth first search techniques so as you solve more and more problems it gets easier and easier because once you solve a particular problem with the technique then you know the technique and when you solve more and more problems related to the same technique then you get better at identifying those problems similar problems easily and once you know the technique very well for example like you are very familiar with the depth-first search or breadth-first search then you know all the boilerplate code how things go and he will feel more confident about deficits and also sometimes problems can be solved using multiple ways for example a problem can be solved by using sorting or you can find a optimal solution using priority queues as well so you can solve the problem with whatever technique that you know of you get better at solving medium level problems by knowing more and more techniques and getting better at this techniques so this is where the Related Topics helps a lot so these related topics are just the techniques that you need to know so this is the breakdown of the topics and also one problem can have can be related to multiple topics most of the problems are associated with array which is not surprising surprisingly there is like a lot of problems on lead code our dynamic programming problems so a lot of companies are obsessed with dynamic programming let's look at the breakdown for hard problems what are hard problems made of like what topics do they cover not so surprisingly most of the hard problems are dynamic programming so now let's look at another data which gives you some information about which topics are harder than other topics all the different topics sorted based on their difficulty for example like rolling hash so first bar is a rolling hash there are very few questions related to rolling hash but all of them are considered hard questions there is segment ring I mean you might never heard of segment tree then there is binary index tree there is line sweep these are like very unique kind of problems so that's why most of them are hard problems and also divide and conquer so divide and conquer is one of this interesting topic that everyone in computer science have heard of divide and conquer for example you know what merge sort is quicksort is how it works but so if you try to come up with a divide and conquer approach in an interview good luck with that as we saw there are a lot of problems in dynamic programming and as you can see around like 50 percent of them are considered hard which is not surprising right dynamic programming problems are considered hard and after that it gets easier and easier so this is like the continuation of the data these are the easier topics also you can see that tree and linkedlist problems are like the easiest ones to write so this data should give you like some confidence and reduce your anxiety about the interviews for example like not all questions in Google or Facebook are hard questions so this data in lead code is as close as it gets to the reality so lead coders like primarily mostly used in u.s. so you can see that like it gives a pretty good representation of companies at least present in u.s. especially in Bay Area and also they may not have enough data for companies in India's so in lead code you can see the questions which are specific to the companies I think this is the most important feature as I said I have interviewed with most of the top companies in the area and I can say that all the questions asked in the interviews were there in late code so that's why I said like lead code is like the best resource for preparing for interviews so if you have interview scheduled for a specific companies then you don't have to look anywhere else lead code is the place so that was all the information that I wanted to share I really hope that this information makes your interview preparation little bit easier and gives you a better sense of how to prepare for the interviews and come up with a strategy and also I want to make one thing clear this is no way a paid endorsement for lead code I am no way associated with lead code so from a Candide perspective being in the same situation of interviewing process I feel late code premium is one of the best investment you can make for your interview preparation so there are like lot of free features and also premium features I'm not going to like explain what the premium features are but I can tell one thing that like lead code premium is one of the best investment you can make for your interview preparation hands down so with that all the best with your interview preparation talk to you guys in the next video
Info
Channel: Ajay Prakash
Views: 63,911
Rating: undefined out of 5
Keywords: leetcode, interview, coding, siliconvalley, google, amazon, facebook, dynamic programming, data analysis, bay area, codinginterview, preparation, codinginterviewpreparation, howtoleetcode, howtoprepareforinterview
Id: RDv81ummQRI
Channel Id: undefined
Length: 19min 55sec (1195 seconds)
Published: Sat May 16 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.