Solving A Problem Every Day…

Shivam Rathore
Tech x Talent
Published in
3 min readOct 23, 2020

This is a story of how I ended up starting and developing a habit of solving a problem every day, accidentally. And as they say, “Good habits are worth being fanatical about.”, so I am.

Solving a problem every day…
Photo by Olav Ahrens Røtne on Unsplash | Last step of solving the cube

On September 03, 2020, I found this website Daily Coding Problem, where you can subscribe to a newsletter and get one problem a day in your mail. I like the initiative, so I immediately signed up to test it, as I had never seen such a use of a newsletter. And as they say:

People find their paths in the strangest of ways.

The thing which was started to explore the newsletter, resulted into a habit, and by the time I am writing this I have solved 50+ problems, with a difficulty level ranging from easy to hard.

The interesting part was that it was fun solving them and they involve a lot of learnings. Also, some problems just took some seconds to be cracked, some took minutes, but some even required external readings to solve them. I remember the one involving the Monte Carlo method for estimating the value of pi(π). I had never even heard of the name before, so eventually had to read and understand it, and it turned out to be a really amazing method of sampling using randomized data.

Daily Coding Problem #14 | Shivam010/daily-coding-problem#014

To keep the problems and their solutions in one place, I decided to maintain a Github repository 👇.

And after some days, due to the tedious handy work of creating the directory and file structure for the problem and editing theReadme file to incorporate the new problem statement, I decided to automate the task using Github Actions and wrote a CRON job workflow to create and maintain the directory structure and update the Readme file with all problem statements. In the end, all I have to do is to copy-paste the problem from the mail to my solution file, in the comments.

Yes, you thought it right, I could also add a step to read the mail in script, but well I do not want to go that deep for such a simple task. 😛

Additionally, I also decided to include the statistics of the problems I solved or the day I may miss for more motivation.

A sample Readme file generated using the script in here.

I don’t know how many problems I am going to solve, for now, I am going to enjoy solving them. And if you find it interesting and want to join me, feel free to clone my setup and use it, and if need any help, create an issue or contact me, I’ll be more than happy to help.

Shameless invitation: If you want to review my solutions or want to add something more in the workflows, like the copying problem text from mail, I am open for accepting PRs, code reviews, or anything you feel can be corrected.

Spoilers on the future updates of my current habit. I am planning to start a newsletter by writing short articles on all the solutions and their approaches. If you are interested, please do follow me.

--

--

Shivam Rathore
Tech x Talent

It’s not that I am weird. It’s just that everyone else is a way more normal. Living at work. ~ Sh https://shivamrathore.com/