I solved 541 Leetcode problems. But you need only 150.

I solved 541 Leetcode problems. But you need only 150.


I solved 541 Leetcode problems. But you need only 150.

  1. How to use Leetcode effectively?
    2. How to learn Data Structures and Algorithms?
    3. How to use Leetcode solutions?
    4. Whether to use Python for Leetcode?
    5. How to crack coding interview?

    I will answer all these questions in this video.

    ► FREE resources:
    1. Leetcode Top Interview Questions (150 Problems): https://leetcode.com/problem-list/top
    2. Selective attention test:    • selective attention test  

    ► For more content like this, subscribe to our channel:    / powercouple26  

    ► Follow us on Linkedin:
    https://www.linkedin.com/in/gabag26
    https://www.linkedin.com/in/sarrabounouh

    ► Let’s be FRIENDS! https://www.instagram.com/power_coupl

    ► For business inquiries, reach us on: [email protected]

    #datastructures #datastructuresandalgorithms #leetcode #codinginterview

    DISCLAIMER: All opinions shared on this channel are our own and don’t express views or opinions of our employers. We only use our experiences and public knowledge to make our content. NO CONFIDENTIAL INFORMATION of our employers is used or shared on this channel. This is not a Professional Coaching channel, it only highlights the public resources that have worked for our careers.

Content

0 -> Coding Interviews are very easy.
1.459 -> That’s what I thought
2.335 -> when I went to Leetcode
3.086 -> and attempted this “Rotate Array” as my very first problem
5.839 -> After spending 6 hours on it
7.507 -> I had not written a single line of code.
11.094 -> I was extremely frustrated
12.595 -> and went to the discussion section to read the most upvoted solution
15.765 -> Another 2 hours passed
17.183 -> and I could not even figure out why this solution works.
19.769 -> At this point,
20.687 -> my frustration had transformed into disappointment
23.231 -> I somehow managed to put myself to sleep that night
27.569 -> and the next morning,
28.737 -> I went to a friend and asked him to solve the exact same question.
31.698 -> And that’s when I learnt something really interesting about the human behavior
34.576 -> If you can not solve a problem,
36.036 -> you feel sad.
36.911 -> But if your friend solves the exact same problem in under 15 minutes,
40.206 -> you are heartbroken
41.75 -> After facing many hurdles like that,
43.501 -> I managed to solve 541 problems on Leetcode
46.254 -> Along the way
47.172 -> I collected many amazing job offers
49.007 -> Today,
49.507 -> I am going to share everything that I have learnt in the process. At the end of the video,
53.219 -> I will also answer a very important question
55.18 -> And that is
56.097 -> “How to know if you are ready for interviews at big tech companies?”
58.85 -> Before you can even start on Leetcode,
60.685 -> you need to have a good understanding of “Data Structures and Algorithms”
63.772 -> I have already covered this topic in my last video
66.107 -> which I will link at the end.
67.233 -> Once, I finished the basics of DSA,
69.235 -> I went to the top interview questions on Leetcode
71.279 -> There are exactly 150 problems in there
73.698 -> and all of them are very important
75.158 -> I recommend that if you are solving a problem which is outside these 150 problems,
79.079 -> make sure that it’s your 151st problem.
82.916 -> Now that you know where to start,
84.459 -> let’s discuss what’s the right strategy to solve these problems
87.545 -> I am sure you already know that all problems on Leetcode are tagged easy
90.715 -> medium or hard based on difficulty level
93.218 -> And if you look a little closer at the “Rotate Array” problem which was my very first problem on Leetcode,
97.305 -> it’s tagged as a “medium” difficulty problem
99.432 -> Starting my Leetcode journey with this problem was the first big mistake
102.936 -> I made 2 other mistakes that I will share later in this video
105.814 -> This problem was a mistake because if you are looking to stay motivated
108.775 -> and actually improve your programming logic
110.735 -> you have to start with easy problems
112.946 -> As you solve some easy problems
114.823 -> you will start collecting some tools for your toolbox
117.158 -> And when you reach the medium problems
118.868 -> you will be able to use some of these tools to tackle them
121.121 -> This approach has 2 major advantages
123.289 -> One,
123.832 -> you will not lose your confidence like I did
125.917 -> when I encountered my first medium problem
128.044 -> The second and the bigger advantage according to me is that when
130.588 -> you solve the medium problems,
132.215 -> you will actually learn more from them
133.758 -> Let me explain what I mean by this
135.552 -> Imagine that you have not solved any easy problems
137.595 -> and you try to solve a medium problem
139.514 -> Let’s say you are not able to solve the problem
141.516 -> and you look at the solution
142.767 -> There is a good chance that you might not be able to understand the solution
145.979 -> and even if you do
146.938 -> it’s highly unlikely that you will grasp all the nuances of the solution
150.4 -> So, having some easy problems under your belt is a must before moving to the medium problems
154.571 -> Let’s go back to our “Top Interview Questions” and sort them by difficulty
157.866 -> Solve these 37 Easy problems
160.034 -> before you move on to the mediums
163.621 -> Now that you know the high level Leetcode strategy,
165.874 -> let's dig a little deeper and see how to approach any new problem
169.002 -> And this where you will see a big difference between a Newbie and a Pro interviewee
172.505 -> Let me tell you how a beginner solves any new problem
175.008 -> They read the problem statement and immediately start coding a solution
178.386 -> What they don’t understand
179.637 -> is that we should leave multiprocessing to the computers
182.182 -> Our brains are not built to think
184.058 -> and code the solution at the same time
185.977 -> Infact,
186.644 -> as much as the productivity gurus would like you to not believe this
189.856 -> we humans can not multitask
191.816 -> Our focus
192.65 -> is like a zoom lens of a camera,
194.319 -> we can zoom in to see that one thing
196.237 -> or we can zoom out to see more things
198.281 -> but we can do both at the same time
200.366 -> If you don’t believe me,
201.451 -> you can try out this “Selective Attention Test” by Professor Simmons on Youtube
205.246 -> I will link it in the description
206.873 -> if you are with me on this,
208.208 -> I would like you to break the process of solving a coding problem into 2 separate steps.
212.337 -> Step 1
213.171 -> is coming up with the solution in your head
215.048 -> and Step 2 is actually coding it up in the editor
217.634 -> Sounds obvious, doesn’t it?
219.219 -> Well,
219.886 -> it’s not that simple
221.012 -> You see,
221.638 -> when most people are thinking about the solution
223.848 -> what they are actually thinking about
225.35 -> is how to code the solution
227.143 -> and there’s a big difference between the two.
229.145 -> To explain what I mean,
230.396 -> let’s walk through this easy problem on Leetcode.
232.649 -> In this problem,
233.65 -> you are given the root node of 2 binary trees
235.985 -> and you need to tell whether the 2 binary trees are the same
238.571 -> You can pause the video here if you want to solve the problem yourself
241.574 -> A beginner might look at the given function and start thinking about checking the value at the root node of both trees
246.871 -> to see if it's the same.
248.206 -> In the next step,
249.165 -> they would start thinking how they can compare the value of the nodes to the left
252.71 -> or the right of the root nodes
254.379 -> This way of solving might work for this easy problem
256.881 -> but if you are doing this,
258.132 -> you are actually thinking about how to code the solution
260.51 -> Now,
261.135 -> I want you to forget that you know how to code.
263.137 -> Just think about this
264.514 -> Given the root nodes of 2 binary trees,
266.808 -> What needs to be true for them to be the same.
268.977 -> Value of the root node needs to be the same,
271.229 -> the left subtree needs to be the same
273.106 -> and the right subtree needs to be the same. Once you see that,
276.025 -> the solution is just this one line of code
278.278 -> where you check all 3 conditions
281.781 -> Training your brain to differentiate between thinking about the solution
284.951 -> and coding it up
286.035 -> requires a lot of practice
287.537 -> But if you practice enough,
288.83 -> you will reach a place where you just have to think about the solution
291.749 -> Once you have a clear solution,
293.334 -> the coding part will start coming naturally to you.
295.503 -> In my interviews,
296.421 -> I rarely spend more than 15 minutes on writing the actual code
299.549 -> Most of my time goes into thinking about the solution
302.135 -> so keep practicing
303.303 -> It might take 100 problems for some
305.305 -> and 500 for others like me
307.14 -> But you will eventually get there.
310.685 -> Before we talk about how to know if you are ready for interviews,
313.563 -> let’s talk about how to practice
315.648 -> And this is where I made my second big mistake
317.817 -> And that is
318.609 -> I spent way too much time on one problem
320.778 -> It was mainly because my ego was very high. How am I not able to solve this problem?
324.991 -> Maybe if I give it a little more time?
326.826 -> By doing this
327.744 -> I would end up spending upto 3-4 hours on one problem
330.496 -> In an interview,
331.372 -> you only get 45 minutes to solve a problem
333.75 -> Why should your practice session be so different?
335.96 -> In my opinion,
336.919 -> if you are not close to the solution in 1 hour,
339.13 -> you should give up
340.006 -> and spend the rest of the time on looking at the solutions of the others and learning from them
344.052 -> So, go to the discussion section,
345.845 -> sort the solutions by most votes
347.93 -> and read at least the top 3 solutions
349.932 -> I recommend 3 solutions and not just the top one
352.685 -> because sometimes
353.978 -> the top solution is not practical for the interviews
356.647 -> Try to understand the solution rather than memorizing it
359.4 -> because you will not be able to replicate the solution in the interview
362.403 -> After understanding the solution,
364.113 -> come back to the editor and code it up yourself.
366.491 -> Even if you think you are writing the exact same solution that you just read,
369.952 -> do it.
370.578 -> That’s because many times,
371.954 -> there are some corner cases that you will not be able to see just by reading
375.166 -> And when you hit the test cases that don’t pass,
377.46 -> you will appreciate the difference between “less than” and “less than or equal to” much better.
381.631 -> But what do you do if you are able to solve the problem?
384.092 -> And this is where I made my third and the final mistake
386.803 -> After solving a problem,
388.221 -> I would just move onto the next question.
390.014 -> And that is not the best strategy because your solution might not be optimal
393.476 -> It might pass all the test cases
395.269 -> but there still might be some better solutions out there
397.688 -> I recommend reading the top solutions no matter what.
400.316 -> This is especially important if your solution is too lengthy and you think you can not solve problem in the interview time
405.78 -> In my opinion,
406.781 -> if you are writing a solution that is more than 20 lines of code,
409.742 -> There’s a good chance that there’s a better solution out there
412.495 -> So, there’s no harm in learning from others
416.29 -> Many people ask me how to decide whether they are ready for coding interviews
419.293 -> Are 200 problems enough
420.92 -> or should I do 500?
422.255 -> To be honest,
423.005 -> it doesn’t work that way in life
424.674 -> It’s less about how many problems you have solved,
426.843 -> and more about how good you are at solving any new problem
429.554 -> I believe
430.138 -> that we should answer this question from an interview standpoint
432.849 -> An interview is usually 45 minutes long
435.017 -> and in most interviews, they ask you a Leetcode medium problems
438.062 -> Accounting for the pressure of the interview
439.856 -> and adding a buffer for the introductions,
441.774 -> if you can consistently solve Leetcode mediums in less than 30-35 minutes,
445.778 -> you are ready to go
446.904 -> Reaching this level on Leetcode is impossible
449.115 -> if you don’t have a strong foundational knowledge of Data Structures and Algorithms
453.202 -> To learn how I mastered Data Structures and Algorithms,
455.913 -> watch this video
456.789 -> My name is Sahil and I will see you in the next one

Source: https://www.youtube.com/watch?v=xF554Tlzo-c