Having solved more than 1500 leetcode problems and having cleared interviews at companies like Amazon, Google and Microsoft, there are things I have learned that I want to share with you in this video to make your journey easier and less painful. Today I will explain how I would use leetcode if I were starting from scratch. I will answer most common questions people have while starting their leetcode journey and share resources you can use to become more productive while practicing. Question, why do I even need to do leetcode?
Can't I get a software development job without leetcode? Well, the answer is yes. you can get a software development job without leadcode. There are many startups that don't ask these type of questions.
But if your goal is to work at big tech companies like Amazon, Google, or Microsoft, you'd need to practice on leadcode since it's the best platform to prepare for their interviews. Which programming language I should use for leadcode and interviews? Many people get confused when deciding which programming language to use.
Well, there is no right programming language as long as it's a popular one like C++, Java, Python, or JavaScript. If you're new to coding, and don't know any programming language, I would recommend going with Python since it's easy to get started with and has a simpler syntax. If you already know a programming language well, stick with it.
You don't need to be an expert but you should understand basic syntax and concepts like loops, conditional functions, and basic input and output operations. Most programming languages come with inbuilt support for common data structure and libraries. For example, the STL in C++ and the collections library in Java. So spend some time learning these.
It will make your journey a lot easier. Question. Does choice of programming language matter in big tech interviews? The answer is no, as long as it's a well-known programming language. The reason it doesn't matter is because a programming language is just a tool and you can solve the same problem using multiple programming languages.
I started using C++ in the beginning, then switched to Python and finally to Java, since most of my industry experience was in Java. I am new to data structures and algorithms. How do I learn this?
Before solving your first leetcode problem, You should have some idea about computer science fundamentals such as time and space complexity as well as basic data structures and algorithms. You don't need to go very deep since most of the learning will happen while solving coding challenges. But make sure you are familiar with how to calculate time and space complexity of an algorithm using Big O Notation.
Learning Big O Notation will help you improve your algorithms and better understand why your algorithm may be running slowly. Once you have a grasp of Big O Notation, familiarize yourself with fundamental data structures like arrays, strings, binary trees, link lists, stacks, queues, and hash map. And learn basic algorithms such as sorting, searching, and recursion.
You don't need to know advanced concepts, but it's important to know how to implement basic concepts in your preferred programming language. To learn these topics, you can find many resources online. One YouTube channel that I found particularly helpful for learning data structures is William Fissett.
They have a data structure playlist where important data structures are explained visually. If you like reading books, then I recommend reading Data Structures and Algorithms Made Easy by Narsimha Karumachi and Cracking the Coding Interview by Gail Lachman McDowell. Question.
There are thousands of problems on LeetCode. Which ones to solve? If you are a beginner, start by solving problems by topic. This approach will help you gain a deeper understanding of each topic and learn which data structure or algorithm to use for a specific problem.
For each topic, start with easy problems. Once you can comfortably solve easy ones, slowly start challenging yourself with problems which are slightly outside your comfort zone. you must constantly challenge yourself to get better. Don't worry about hard problems in the beginning.
In most interviews, you will encounter medium-level problems. So focus most of your time on those. The types of problems asked in interviews differs from company to company and it depends on the role you are interviewing for.
In general, back-end roles tend to ask harder questions compared to front-end roles. And fan companies ask more difficult questions compared to startups. For senior roles, experience and system design matter more than lead quote questions.
If you already have some experience with Leetcode or similar platforms, you can choose curated lists of problems like Neatcode 75 or Top 100 Liked or Top Interview 150 Questions on Leetcode. Don't spend too much time on highly disliked questions. They will drain your energy and demotivate you. Sometimes you may come across a problem that is tagged as easy but still proves to be difficult to solve.
Don't get discouraged. This is all part of the learning process and sometimes Leetcode doesn't do a good job of classifying the difficulty level of the problem. Avoid jumping between problems too quickly.
Give each problem sufficient time and effort. After every problem you solve, ask yourself, what is one thing knowing which made everything else easier? Question. How many problems should I solve? This is subjective and depends on the level at which you are at.
If you are new, you would need to solve more problems. In general, 300 to 400 problems should be good enough. A mistake I made in the beginning was rushing to increase my problem count without spending enough time on each problem.
Instead of focusing on the quantity of problems you solve, focus on what you learn from each problem. It is much better to thoroughly understand and solve 20 problems than to solve 100 problems without much understanding. Also, try to make it fun. There is a fun in learning to solve coding challenges. It's not just about getting a job.
I was able to solve such a high number of problems because I enjoyed challenging myself and felt excited whenever my solution was accepted. Question, how do I approach a new problem? Take some time to understand the problem statement and the expected input and output. Write it down on paper if it helps. Start with brute force solution and then work on optimizing it.
Think about how you can improve the algorithm or reduce the time and space complexity. Plan your approach before coding. Coding is easy once you know what you are going to write.
So before writing a single line of code, make sure you understand what exactly you are going to write. That's one reason why programming language doesn't matter much. Because it doesn't take too long to implement a solution, means you have a good idea on what to write.
Develop the habit of analyzing the time and space complexity of every problem you submit. Interviewers focus a lot on finding optimal solutions and may ask about the complexity of your code. It is a good practice to test your code with small inputs including edge cases.
Question. If I am stuck with a problem, when should I look at the solution? Give at least 30-60 minutes of focused effort to a problem.
If you are still stuck, look at hints and solutions. Don't spend too long on one problem. Read the official solution and try to understand the top-ordered solutions.
You can check out this extension called Leetcode Video Solutions which allows you to watch solution videos directly on the problem page. Don't just move on after being the solution, try to implement it yourself. Also, since you were able to solve this problem on your first attempt, it's a good idea to market for revision and revisit this problem after few weeks.
How do I solve more problems in less time? The answer is to learn patterns. Instead of focusing on individual questions, concentrate on identifying patterns. On Leetcode, You will come across multiple problems that follow a similar pattern. Once you know how to solve one of them, you can apply the same approach to solve others.
For example, after learning this sub-string pattern, I was able to successfully solve more than 20 sub-string questions using the same approach. I have created a GitHub repository to list common lead code patterns from different articles. You can find the link in the description.
Question. Should I memorize solutions to difficult problems? When I was a beginner, I used to memorize the solution to the difficult problems and move on.
I later realized that it was a big mistake. Memorizing solutions does not improve your problem solving skills and it is not helpful during interviews because the interviewer might ask a variant of the problem or a follow-up question. Inform is a retained through understanding is more likely to stay with you long term.
During interviews it is important to explain your thought process. If you have only memorized the solution you may struggle to convince the interviewer why your solution will work. How do I practice like I am in an interview? Solving a problem during an interview is very different.
from solving it at home sitting at your sofa. That's why you need to practice in a timed environment. There is a leetcode extension called Leetcode timer that you can use to time yourself while practicing.
I highly recommend participating in leetcode contests as they provide the best way to practice in a timed environment. Don't worry if you struggle to solve even one problem in the beginning. The whole point is to gain some experience solving problems within a time limit. When I started giving contests, I was able to solve only one to two problems. But with more I was able to solve three problems and sometimes even all of them.
Question. Do I need Leetcode Premium? If you are just starting out, you don't need to purchase Leetcode Premium.
There are three main benefits you get as a premium member. First is you can unlock premium only problems. Second, you can access the company specific problems.
And the third, you can access visual solution to some of the problems. But all of these you can find easily online for free. If you need visual explanation of any problem, simply type Leetcode on YouTube followed by the problem number. No matter what problem it is, you will find plenty of high quality videos explaining its solution.
If you want to learn more about my coding journey and how I went from zero to cracking interviews at multiple big tech companies, you can check out this video. If you have any questions or want me to make a video on another topic, let me know in the comments. I wish you all the best. Thanks for watching and I will see you in the next video.