100 Leetcode Problems Celebration

Hi all Friends,

I have completed 100 questions yesterday, it's a bittersweet day.

My blood is all over my keyboard and leetcode.

And still after all this efforts I still feel like I'm just getting started.

So in this post I intend to make a summary of what this journey has been too me, some of my practices, and stats.

Please feel free to give your feedback and advice, I deeply apreciate that :)

If you like this article you might like my 200 Leetcode Problems Celebration

If you like this article you might like my 300 Leetcode Problems Celebration

If you like this article you might like my 400 Leetcode Problems Celebration | The Awakening

Goal
My goal is to change job, I've an interview in August, I'm doing my best to get at a good level by then.
by good level I mean mastering the usual suspects data structures, and most relevant algorithms for striking problems.

Problems per Difficulty
52 - Easy
43 - Medium
5 - Hard

Biased to avoid easy questions
I'm not a junior developer, but I have to confess that I had big lack of knowledge of Big O Notation and how to develop well performant code. But still as I always was a good employee my pride was on the line. So In the begining I intentionally avoided easy questions and jumped to medium questions. In my mind I was too good for easy questions.
I was not stuck, I was able of doing Medium questions since the start without looking into solutions, and sometimes with very good performance. but I took like 4hours or more between design and solving (I didnt check the solutions in the begining). Fortunately, after some days I swallowed my pride. And decided to start doing easy questions because I was clearly lacking knowledge.
And it payed off. I learned many cool things with easy questions. Easy questions teached me many fundamentals, on data structures, some algorithms (binary search) and Math inclusively which I had pretty much forgotten. So going to easy exercises was not a shame but something valuable.

Time spent per question
Easy problems (~ 1h - 2h)

  • solving 30m to 1h
  • solutions 30m - 1h

Medium problems (~3h30)

  • solving 2h00
  • solutions 1h30

Hard Problems (If I can solve them ~7h)

  • solving +5h
  • solutions +2h

This is too much, and some weeks or days ago I made a post talking about consistently taking more than 45 minutes, and from there I started cutting off time.

But the recommended time was from 15 to 45 minutes.
15 to easy
30 to medium
45 to hard.

At this times, for each difficulty, I'm frequently still designing a solution on paper.

My read is that I'm still not prepared, and need to practice a lot more, until I can recognize the patterns well. thus spending less time figuring out a solution.

What Questions I did
I started doing questions randomly, sometimes popular questions from top 100, other times top 100 of some company, other times one of the most frequent. and I always tried to do different questions (evaluation by title), Sometimes I search for smallest , Largest, K, Merge, Intervals, Closest and pick some question.

But overtime and despite I was able of doing most problems (without checking solutions), I spent a lot of time, and didn't came up with an optimal solution. more over as I was constantly doing different questions I didn't have the amount of questions to start recognizing patterns. So despite it was a spoiler I did something different for bit manipulation and tried to work specifically bit manipulation. the same for binary search, the same for graphs.

It is true that it was a spoiler to know I'm doing a graph based question, but is also true that If I can't recognize the patterns I need to do a good number of exercises to start identifying them. And doing always random exercises did't help me out.

after like 60 questions or so I started working specific things, and I felt more progress this way. is diferent to do a binary search or graph question every day, or once per week or month.
So I'm targeting specific caegories, but not forgetting that I still should do some random question to fully test my analysis (unbiased by problem category).

Overcoming weaknesses
Not all my weaknesses are resolved.
But my strategy is simple, do some good exercises on the topic so that I can understand the patterns and apply in other exercises.

My main weakeness until now
Recursion - it was dificult to think like this. the last time I wrote a recursion solution was in college for a very specific feature. So I had to work my ass to understand how it works and I overcame it.

Backtracking - was something that I could not really understand, as I had troubles understanding recursion, there was no way I could understand backtracking. But with more and more exercises, I was able of understand it and is now easy an subject.

Bit manipulation - a problem because I just dont use it on my daily tasks, never used it in my life before leetcode, so I had to work specifically on this problems

Math - big problem, I was a good student, but I basically memorizd formulas, so this time I was forced to understand. I still didnt do a lot of this problems, but I did enought to recover basic knowledge.

Binary search - never did a binary search in my life until leetcode, at the start I thought that it was pretty basic, but when I had to apply it, it was a nightmare. It look the most arbitrary signals comparison ever. sometimes "low <= high" other times "low < mid", other times "high = mid - 1", other times "high = mid". It was tough in the begining and it still is, for non obvious cases. but I'm now able of doing easy and some medium exercises.

Greedy algorithms - they are just hard to me. the problems itself are hard to get right. I've not done focused work on this yet.

DP - I still have not get it, and I've not focused my energies in here too. but I'll soon. what gives me most discoumfort is DP with tabulation, not memoization. very rarely I find the pattern to apply it.

Graphs - I started last week focusing on graphs, but I'm still green. this data structure is so vast. at the moment is my most difficult data structure, for the amount of theory behind it and its applications. It requires some very specific knowledge.

Time Complexity - It is still not something I completly master. I find it particularly difficult on recursive problems. The best approach I came up with to try to figuring out time complexity was testing the output of the methods. but still this is not practical and is pretty error prone, because you might not figure out weel all possible outputs. So I still need to find a way to be more precise on time complexity.

Solving Problem's Process
My process might be quite inefficient, and I think I really need some good advice, it starts like this:

  1. reading the problem
  2. designing a solution in the paper
  3. doing the code in paper
  4. migrate the code to a IDE or leetcode
  5. run and debug without IDE if too much time pass( +5mins) I debug with IDE

I tried do this in a contest and well [except 5) ]... times up..
What is your process? does it make sense to write code in paper?
I like, but there might be a better option.

Contests
My first contest was 188 (virtual).
It was very important to me, because I was thinking that I was doing great on code problems, but not even close.
I only made one question on time.
I only did the easy question. for the next medium question I took more time than the full contest.
Actually I didnt solved it at all. I'll solve it later.
I took a lot of time to get the program compiling had a lot of troubles debuging.
The most valuable lessons from the contest were:

  1. I'm too slow
  2. I cannot debug my code very well without IDE
  3. I need to keep doing this contest exercises because they are a cool random source of exercises
  4. there are very well prepared people! I need to practice more!

Revisiting Questions
"Do a question once and never visited again" This was my philosophy. but in the begining I was not worried with optimal solution, I just wanna solve. At the begining I didn't even watch the solutions (first 4-8 questions) if my solution were 100% I just moved. so around 60 questions solved I was prompt with permutations (a problem I already solved), and I could not come up with a solution. I battled for 1h30 to come um with a weak non optimized solution. that was the moment I realized that I needed to review my previous questions, specially If I didn't implemented an optimal solution. and It still is a problem that I have not completly resolve today. A strategy for reviewing questions.

What is your Strategy to review questions if any?

This Is No Joke!
When I see the effort I'm putting in I can only think that I'm preparing for running for president. What the hell man.

I'm being heavily tested both mentally and physically. I have to be organized, I have to be consistent, I have to deal with large volumes of data, I've to keep my social life, I've to feed my interest in life, I have to tame my emotions, I've to learn how to deal with failure, etc, etc, etc... is it easier to run for president, right?

God damn man,

this is no joke, depending on your timings you might need to transform yourself into a super human, the good news is that it will be useful for your life.
My advice is to start as earlier as you can, because if you have more time to prepare, all this process will be much easier.

Optimal Solutions
Developing an optimal solution is not easy, it requires knowledge and practice.
I can come up with optimal solutions but many times I dont, specially when it relates with DP, greedy algorithms, Binary search (non trivial problems) or some pre existent and well known algorithm which I don't know.

The way I plan to strike this is by keep practicing and working to achieve optimal solutions in every question, if I can't find one, I should read solutions and implement it. reading solutions every time is now mandatory for me.

What do you do?

Getting It Right At First Attempt
I was not able at all of getting a solution right at first attempt. I'm still not able of doing it.
I very often fail at first submission/run for some case. I don't quite know exactly how to improve this.
And feedback is pretty much appreaciated.

What I try to do is to follow a procedure to verify if all my testcases are covered, reviewing the code one last time, verifying initial guards. and I can validade some common mistakes that I make, but that's all.

Maybe as I get more experienced I can get it right more often.
However when problems have a lot of code it becames very very difficult to keep everythingk tight.
As of now, I feel a bit naked on this.

Managing Emotions
In the begining it was very hard, all my life was consumed. I started doing this exercises and my thoughts were swallowed by programming. I had literally no space for anything else. it was sick. and I had to fight hard to gain control of my life again. I ended everyday like a pulp. it was a big mess. but after two weeks I was alright.

then another thing that affected me was that I was trying to prove that I'm capable of doing this exercises. "I'm good enough to do them". "I'm smart, I can do this!" "I always achieve my goals!" "I need to do this to prove how good I am!" "If other people can master it I can master it too because I'm no less, I'm gonna prove myselft that I'm no less than the guys out there!"

It turned out this was a toxic thought. and as a result I started going to bed very late, just to "prove myself". and overtime my performance went down until it plummed. and I was at a lowest point ever, even before I started. doing one exercise per day. And when the day was bad, I didn't want to talk to people, I really got upset.

But then I realized that..It's OKAY to FAIL ..My goal is to learn and I have no need to prove myself.
I'm just a human being like any other. and failing is the natural result. Getting it right is indeed the abnormal result.
So since I've embrace this new mindset, I'm now able of living life again. I'm able of giving up, and go to bed. I'm able to talk to my mother or brother when I have a bad day. And I also believe that I've won a new philosophy for life.

Biased to avoid easy questions part 2
From doing like 80 questions until now, I was strike again with not wanting to do easy questions, but this time is not because I think I'm too good but because I feel like I need to work on some specific weakeness that I have. And I prefer to prioritize those. Like, Graphs, DP, Greedy Problems, Binary Search and still have to build knowledge in Systems Design because I'm no Junior at all but at some levels I feel like one.

Expectations & Next Steps
This is more difficult than I ever imagined. I thought that by this amount of questions I would be able to pretty much solve questions easily and find some of them harder.

But that's not the case, I still find pretty much every question a challenge and by no means I can do a medium and sometimes a easy problem in the interview time.

So plenty of work still needs to be done, And I'll do things a little bit different.

I plan to continue doing new questions, but I want to consolidate the questions I've done so far, which means, That I need to revisit the work and algos I've done in the past.

I really believe I can reach a good level and I'll keep working hard for it, but I also want to add more strategy to make the most of every question.

Moreover I plan doing Mock interviews starting this month to taste a little bit of it and get extra feedback. and eventually get more connections.

My sleeves are up, and I'm ready to war.

Very Grateful
I'm very grateful to belong to Leetcode community.
This is the best thing that happen to me in regards to CS.
I've been learning so much.
Many many questions are so well design for teaching you something, that we have to praise the guys working their ass out to bring us this challenges. So amusing that even though they make me spit blood in the end of the day, and still want more.

Thank you so much guys!

Please Feel Free To Feedback Me
Hope you enjoyed the read.
If you have advice for me, please I'm all ears!

Have a nice day

Follow-Up
If you like this article you might like my 200 Leetcode Problems Celebration
If you like this article you might like my 300 Leetcode Problems Celebration

Comments (4)