DEV Community

Cover image for 1 Year of Consistent LeetCoding
Davinderpal Singh Rehal
Davinderpal Singh Rehal

Posted on

1 Year of Consistent LeetCoding

It was September 2023, a time when change was in the air. I found myself between jobs, and as luck would have it, Google had just kicked off a hiring wave in Nairobi, Kenya. I came across the Google Foobar challenge, a coding gauntlet I'd heard whispers about. With a decade of coding behind me, I felt it was time to give it a shot.

The first challenge was like a warm-up—a binary search problem that felt like a gentle jog. The second and third problems followed suit, manageable and engaging. But then, the fourth challenge appeared, and it was like hitting a steep hill. This was my introduction to graphs, a concept that had somehow eluded me in my career.

Feeling a bit overwhelmed, I turned to YouTube for guidance. As I watched the videos, explaining the algorithms and concepts, I couldn't help but feel a touch of imposter syndrome. How had I worked as a software engineer for so long without encountering these problems?

To cut to the chase: a Google recruiter did reach out. It led to a phone screen and three rounds of interviews. Unfortunately, I didn't make it through. But this experience kindled a fire in me to master data structures and algorithms (DSA).

Determined to improve, I found the LeetCode 75 question set. I tackled it with zeal, making notes and learning heaps. Halfway through, I landed my first contract of the year, which meant less time for practice. To keep pushing myself, I started doing LeetCode’s daily challenges. This eventually led to a 365+ day streak.

I tracked every question in a (Google Sheet)[https://docs.google.com/spreadsheets/d/14GXh2RLulTo2vLeLzOuOqqCm5DQmCI-OK8MJvi9yJz8/edit?usp=sharing]. My system was simple, if I can't solve it within the time I mark it as a fail:

  • Easy: Solve within 25 minutes
  • Medium: Solve within 45 minutes
  • Hard: Solve within 1 hour

Every two weeks, I'd revisit a failed question and give it another shot. Here’s what I learned along the way:

Some Topics Pop Up More Than Others

Arrays (Lists)

Following (PrimeAgen)[https://www.youtube.com/@ThePrimeTimeagen]? Then you know arrays are fundamental to DSA. A year in, I can vouch for it. Efficient array manipulation is essential.

Strings

Strings are like arrays, but with a twist. They’re immutable in most languages, meaning any change requires creating a new string. This was a lesson learned the hard way.

Hash Tables

When mapping data, hash tables are a go-to due to O(1) insertion and deletion. Initially, I thought hash tables were complex, but I learned they’re essentially objects.

Sorting

Know at least two sorting algorithms. Bubble Sort is classic and quick to code. Merge Sort is powerful but takes practice. And there’s Bucket Sort—mind-blowingly fast but space-intensive.

Greedy Algorithms

Greedy problems are intriguing. They allow early exits once conditions are met. These problems still trip me up sometimes, but they’re rewarding to solve.

Conclusion

DSA can become addictive. Once you start spotting patterns, solving problems becomes almost mechanical. I’m hoping for another shot at Google. Until then, I’ll keep grinding LeetCode and getting better at this craft.

Top comments (4)

Collapse
 
anmolbaranwal profile image
Anmol Baranwal

Great 🔥 I was always more interested in GitHub compared to Leetcode. Solved around 124 questions on all topics (except trie) and then moved on. My favorite topic was DP.

Being consistent definitely helps.

Collapse
 
davinderpalrehal profile image
Davinderpal Singh Rehal • Edited

:EDIT: Just realised there is a comment already asking the same

DP is something I still struggle with specially the harder problems. So when you say more interested in GitHub is there a section in GitHub for solving problems?

Collapse
 
kelsey-d profile image
kelsey-d

Do you mean you preferred contributing code? Clarifying just in case there was anythign else GitHub offered it's a completely different landscape to LeetCode.

Collapse
 
amitovhal2 profile image
amitovhal2

Great Article; I felt the same when I first encountered the leetcode problems,
Also, great Excel. If it's okay, can you please share the sheet for anyone to use and track their progress? I didn't get where exactly or how it marked the self-solved problem.