30-Day LeetCoding Challenge

30-Day LeetCoding Challenge

At the end of March, I received an email from LeetCode with an invitation to take part in the "30-Day LeetCoding Challenge." Without too much thinking and hesitation, I decided that it will be a well spend time because it is always good to keep the mind sharp and able to solve some tricky algorithmic questions.

Keep myself accountable

Being social and accountable was quite helpful for me in the past, last time I used Twitter as a feed to post my updates every day, however this time, I tried to get some more bidirectional accountability partners. I shared the challenge with a bunch of my friends to get someone else on board and keep my self accountable, so I could ask for advice or get some encouragement just in case I need it. Unfortunately, most of my buddies did not care much about the challenge, and I ended up with a single buddy of mine who walked with me most of the path. Unfortunately, he decided to stay anonymous so that I will call him - RGB, sounds like a great techy pseudo name. Daily in the evening after my day job, I ping RGB to share my solutions and get some bits of advice if I am stuck or to offer my help if he needs it.

My background

I write code for many years. However, I feel that since the last time I was looking for a job, more than a year ago, my problem-solving skills get a little bit rusty. In real life, most of the software engineers usually do very shallow work and mostly solve integration problems, not some "rocket science" algorithmic tasks, so why not to make life funnier with some hard stuff. I embrace this fact but would like to have my brain sharp and solve the problem efficiently if I face it.

How I approach problems

When I feel I know what to do

First of all, I start with solving the problem on a conceptual level inside my head. Quite often, the first solution that came to mind is a brute force one and has to be optimized. When I feel I kind of know how it should be done, I try to find if there is a way to make it even better still inside my head, and only after it I do try to write actual code.

When I am stuck

Tasks complexity is very different, and it leads to the fact that sometimes I don't know how to solve the puzzle efficiently. One example of such a problem was - "Find bitwise AND for all numbers in range." In this case, I try to find some hints without spoiling an actual answer. Leetcode discussion section becomes very handy; in most cases, I could figure out an appropriate approach to the issue just by reading the headlines.

Double-check and learn

After the puzzle solved, I go to the forum to check if there is a more efficient way to solve the problem and learn something new.

What did I learn

This challenge helps me to reveal gaps in my knowledge and shows me weak spots that should be improved.

Being humble

I did not ever participate in any codding competitions and usually had a good time on interviews, so before this challenge, I was a bit too arrogant and self-confident. Participating in this event and solving and struggling with a bunch of different tasks made me a much more humble. Now I know some areas I should improve, I never encounter such problems in the interview, so I was blind about the gaps in my skills, but now I know them and can mitigate it.

Ask more questions

Often I got my initial solution rejected by online judge. The most common reason for it was some corner case I didn't expect, and it was not described in initial test cases.

Repetition is important

There are several foundational concepts in algorithm design. The ideas are quite simple and clear; however, during one of the tasks, I found out that despite the fact I know the concept, I struggle to code it neatly. After my solutions were accepted, I had to look back to Wikipedia and double-check how idiomatic implementation looks. It is not enough to know something on a conceptional level, and I should be able to implement the majority of fundamental algorithms swiftly and reliably.

Law of the instrument

I found myself very much affected by the law of instrument bias. I spend quite some time focusing on functional programming, and solving the problems recursively is a very natural approach in a functional language. Given approach becomes my hammer and a significant number of the issues start looking like a nail, I could solve it with it. The sad part is that it is not very efficient in most cases.

I don't like to code alone

Many software companies nowadays send preliminary codding challenges to potential candidates to test if they any good. I usually try to avoid it as much as I can, I even offer to code live the same task if someone from the dev team will be on the call with me. There are many reasons for it, but during this challenge, I found that if I start solving the puzzle with a suboptimal design, I will not get it and could waste precious time. During the interview with a real person, most of the interviewers more interested in your mental models and approaches to the problem, so they would hint and steer you without much penalty if they see you thinking well just in a bit unconventional direction.

I should not solve the puzzles right before sleep time

I made this mistake a few times. I was so excited about the tasks and delayed rest for a few extra hours. It causes some new loop in the brain that trigger "problem-solving dreams" that drain my mental abilities over the night and don't let me rest properly. I am not even talking how broken I felt next morning, but lesson learned - don't do intricate brain work right before they sleep.

Greater mean is important

Somewhere on a day 20, I start feeling the lack of motivation. The daily puzzle becomes a chore because they do not lead to any specific goal; it is just solving puzzles for the sake of solving problems. My accountability friend was very helpful and supportive. Still, I should try to figure out some goals before the next challenge to keep myself motivated and aligned towards the actions.

Next steps

It was a great month. I hone my mind and sharpen my problem-solving skills. In my opinion, I should keep solving the puzzles regularly to keep my brain active and in good shape. Before, I used to solve chess puzzles to practice problem-solving skills, but LeetCode seems to be more useful and applicable to real life.

Now when the challenge is over. I am happy that I manage to accomplish it despite all the hurdles and obstacles I have during that month. I hope that my time well spent and I become at least a little bit better software engineer.

Thanks for reading, and see you in a month with my next challenge!

If you want to hear more about what I am doing - hit the subscribe button, and I will deliver updates straight to your inbox.

It is all folks! Stay tuned, subscribe for updates and share this post with your friends.