LeetCode Journey: From Unemployed to Google
This article outlines a personal journey of using LeetCode to prepare for technical interviews, culminating in a job offer from Google. It covers effective strategies, common pitfalls, and whether LeetCode is a worthwhile investment of time.
The Early Stages: Building a Foundation
Initial Struggles and Language Choice
Like many, the author began with easy LeetCode problems. They initially used C++, the first language they learned. However, this turned out to be a slight mistake, as the verbosity of the language slowed them down. Early on, even solving easy problems proved challenging, often tripped up by edge cases.
Essential Data Structures and Algorithms
The author's initial knowledge of data structures and algorithms was basic, encompassing arrays, linked lists, hash maps, trees, sorting, and binary search. This foundation, however, proved sufficient to start solving problems. Practicing easy problems helped solidify their understanding of these fundamentals.
The First 50 Problems: Gaining Momentum
After solving approximately 50 problems, the author could handle trivial problems like reversing a string or inverting a binary tree. However, they hadn't yet tackled graph problems or explored dynamic programming. Surprisingly, these 50 problems were enough to secure an internship at a bank.
Intermediate Grind: Switching Languages and Discovering Patterns
Moving to Python
Around 60-70 problems in, the author switched to Python after observing that Python code in LeetCode's discuss section was consistently shorter and more concise. Despite never using Python professionally, the transition was straightforward. They focused on learning basic syntax, if statements, for loops, and standard data structures.
The Importance of Order
Having solved around 100 problems, the author had learned high-value algorithms like DFS, BFS, sliding window, and backtracking. Yet, they still struggled to consistently solve new problems. The key realization was that the order in which problems are solved matters. Dynamic programming should follow backtracking, and graph problems should follow trees. A roadmap to guide the learning process is highly beneficial.
Consistent Practice and Time Management
Solving one or two problems daily consistently proved more effective than cramming. If a problem couldn't be solved within 45-60 minutes, the author would review the solution. Understanding the why behind the solution is crucial, and there's no shame in seeking help. This approach significantly accelerated their progress.
Advanced Techniques and Interview Readiness
Recognizing and Applying Patterns
By solving around 250 problems, the author had mastered most common algorithm patterns. Writing algorithms like DFS, BFS, and binary search became second nature. They realized that most LeetCode problems fall into predictable categories. Medium problems require identifying the correct algorithm, while hard problems often involve complex tricks.
Assessing Interview Readiness
The author felt confident in their ability to pass interviews but wasn't completely sure about big tech companies like Google or Facebook. They highlight that feeling fully prepared is unlikely and advise aiming for an 80% chance of success. A good indicator is being able to solve a medium problem you've never seen before in 20-25 minutes.
Quality over Quantity
While the author solved nearly 600 problems, they emphasize that quality is more important than quantity. They recommend focusing on around 150 problems, like the "NeetCode 150" list, ensuring a deep understanding of each. Reviewing previously solved problems is crucial for solidifying knowledge.
Is LeetCode Worth It?
LeetCode's Value Proposition
LeetCode may not teach application development, but it sharpens problem-solving skills, especially regarding edge cases and unit testing. These skills are transferable to application development. Algorithms and data structures are widely used in the industry.
Expanding Your Skillset
While LeetCode is valuable, it's not a complete solution. Platforms like Taro can help grow tech careers, focusing on onboarding and promotion through masterclasses with experienced tech leaders.