How I cracked Google Interview after 500+ rejections

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
the year is 2016. I was six years younger and had no gray hair when I was doing my first ever coding interview how would I describe myself three words hard working alpha male jackhammer merciless in those times the interviews used to happen in person and on an actual whiteboard just before the interview I was told that my interviewer is the director of engineering and has years of experience the interview started and after some icebreakers I was given a problem where I had to merge a list of overlapping time intervals all of a sudden my heart started pounding and my throat started feeling drier than the Sahara that's a great question there was a pin drop silence in the room except for the chips my interviewer was munching for five minutes straight I stood there staring at a whiteboard without writing a single line of code in that moment nobody could have predicted that this young boy will be working at Google in a few years and have a lot of gray hair in today's video I'll share how I got over blanking out and embarrassing myself in the coding interviews let's do this the first instinct of most people when presented with a question in a coding interview is have I seen this problem before in fact I know so many people who sold strategy of cracking interviews is memorizing the solutions of popular interview problems well this is one of the most common reasons why people can't think effectively in coding interviews to understand why that is Let's do an exercise together what comes to mind when you see this word you can pause the video and write your answer in the comments now I want you to consider the word eat what comes to your mind now when you see the same word again most people will see the word soup the second time if I had asked you to consider the word shower instead of eat there's a good chance that you would see the word soap instead this phenomenon is called priming the example you just saw is taken from the book thinking fast and slow I highly recommend this book if you want to understand your thinking process better anyway priming is a phenomenon where your exposure to one stimulus affects your response to the subsequent stimulus without even knowing it in a coding interview when you get a problem that's similar to something that you have already seen before your brain can easily convince you that their Solutions must be also very similar and sometimes that can prove to be a fatal mistake let's take the example of this twosome problem you're given an array of numbers and a Target sum you need to find two numbers in the array that add up to this target sum you can assume that there is only one solution to this problem how would you solve this question you can iterate the array and keep putting every number you see in a hash set but before you do that you can check if Target minus current number is already in the hash set and if it's there you have already found the solution if you understand that I want to change this problem a little bit for you instead of giving you just any array I want to give you a sorted array and you need to find two numbers that add up to a Target sum how would you solve this problem now if you have not seen this problem before you can pause the video and leave your answer in the comments as a result of priming many people try really hard to use hash set for this problem as well but that's not the optimal solution this problem can be easily solved using two pointers without using any extra space required for a hash set I will leave a link to the solution in the description initial moments when you are given a problem are very crucial once you start thinking in One Direction it's very hard to pull your brain back and explore another Direction have you ever had an experience where you were trying to solve a problem for a long time but could not make any progress then you took a short break or slept and came back to the same problem and to your surprise the solution was right there in front of your eyes research has shown that when you work continuously you get fixated on previous Solutions and it's very hard to think creatively that's why if you go with your urge of thinking have I seen this before you're bound to get stuck in that train of thought it's going to be very hard to return in the lucky case if you've seen the problem before you might be able to reproduce the solution that you already know but in most other cases the outcome of the interview might not be what you hope for I believe that instead of trying to find some memorized solution you should ask yourself a very simple question do I understand the problem fully and if the answer is no ask clarifying questions not only that write down some test cases and tell your interviewer what you think the answer to those questions is there are two advantages to this one if your answer is wrong the interviewer will tell you why it's wrong and in the process she might drop some useful hints additionally as a result you will not end up wasting 30 minutes of your interview before realizing you misunderstood the problem and number two when you walk through the test cases your brain will start seeing some patterns and these patterns can help you reach the solution faster but how do you find these patterns one way to do this is to completely transform the problem let me explain with the help of a coding problem imagine that you work for a large Construction Company your company has received a big project to connect some cities on the opposite sides of a river with Bridges civil engineers have already completed their inspection and created a list of bridges that can be constructed and this list looks something like this the first pitch in the list would be between a city that has x coordinate of 10 on the north side of the river and a city that has x coordinate of 20 on the south side of the river similarly the second base can be constructed between a city with coordinate 2 on the North side and a city with coordinate 7 on the South Side you can draw the other bridges in the same way now constructing overlapping Bridges comes with a lot of challenges so the civil engineers want you to answer a very simple question for them what is the maximum number of non-overlapping bridges that can be constructed given this list now this looks like a very challenging problem at first but let's examine it a little closely let's say you start from the first city on the south side if you decide to construct the bridge at this city you would not be able to construct all these other bridges that intersect with this bridge all these overlapping Bridges have one thing in common the city on the north side of all these Bridges lies to the left of the north side city of the bridge that you want to construct in other words you can only pick bridges that have increasing x coordinates of North Side cities if you understand that the problem becomes very simple you first sought the bridges by the x coordinates of the cities on the south side now you can pick any increasing subsequence of the north side cities to find valid Bridges to find the maximum number of such Bridges you need to find the longest increasing subsequence of North Side cities and voila and just like that this question has transformed into a very well known problem called longest increasing subsequence which many of you might have already seen before I will link the solution of this problem in the description but here is what I want you to take away from this don't get fixated on the problem that was given to you always ask yourself can I change this problem a little bit and solve the new problem instead of the original one for example in the longest increasing subsequence problem instead of trying to find the longest increasing subsequence of the entire array can I find the longest increasing subsequence ending at a particular index something to think about after you subscribe to the channel another reason why many people can't think effectively in an interview is because they act like an ostrich allow me to explain this auspices are beautiful creatures and we all know how fast they can run but there's a myth about ostriches that is very popular when in danger the ostracies are said to bury their heads in the sand to hide from reality even though this is not true it has given rise to the term the ostrich syndrome the ostrich syndrome is the tendency of some people to avoid unpleasant situations or information in the context of coding interviews being an ostrich means not responding well to the interviewer's feedback I know so many people who get very defensive when the interview points A Fault In Their thinking process or code what you need to understand is that the interviewer is your friend and they are talking to you as if you are their co-worker and at work nobody is right the hundred percent of the time so it is okay if you made a mistake don't be too hard on yourself and ruin the rest of the interview by getting fixated on some mistake you made take the feedback build on it solve the problem and thank the interviewer by saying I could not have solved the problem without your help trust me people love genuine interactions in the interview another thing that has helped me think better in the interview is listening to music just before the interview the main goal here is to calm your nerves and not even think about the interview so 15 minutes before I hop on the interview call I listen to my favorite music which is straight up Punjabi gangster rap but hey to each their own the best way to improve your ability to think in a coding interview is to practice a lot of interview Style problems if you want to know which exact problems you should practice watch this video my name is sahil and I'll see you in the next one
Info
Channel: Sahil & Sarra
Views: 96,453
Rating: undefined out of 5
Keywords: leetcode, leetcode python, leetcode problems, data structures and algorithms in java, data structures and algorithms, coding interview, google coding interview, software engineer interview, cracking the coding interview, technical interview, how to use leetcode effectively, coding interview preparation, programming interview, faang interview preparation, data structures, algorithms
Id: a5Z7pZgVfcQ
Channel Id: undefined
Length: 8min 25sec (505 seconds)
Published: Sat Jun 03 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.