How I Boosted My Productivity With Daily Coding Challenges
Programming is more of a hobby for me than anything else. It ties into my day job here and there but is more often just an outlet for me to keep learning and working on interesting projects in my spare time. I love programming and have ever since my first ‘Coding for Engineers’ class back in University, but a few years ago I found myself unmotivated to work on any projects outside of my job. Since my position at the time didn’t require much in the way of programming, I rarely got to use my coding skills and didn’t think much about it.
A small project popped up at work that would require me to write some Python scripts if I wanted to. I had mostly programmed in C-based languages and MATLAB until this point but had some basic familiarity with Python. I wanted to looked for ways to dust off my skills and develop them further with smaller projects so I began reading up on coding courses, boot camps, and exercises.
After some searching I stumbled upon AlgoDaily, a website offering free and paid resources for developers to boost their skills with a focus on job interview questions. By signing up, I received an email every day with a unique algorithm to try to implement. These algorithms were mini coding challenges including sorting, reversing strings, producing mathematical sequences, and using recursion among many others. Not all of the algorithms were particularly interesting to me, but I always gave them a try nonetheless.
If you choose to pay for AlgoDaily or the alternatives like LeetCode and HackerRank you can get advanced features to further help you learn and prepare for interviews. I only signed up for the free email challenges but I would consider going the paid route if I were looking to prepare for an upcoming interview.
I found each challenge to be a fantastic way to make progress learning what was, at the time, a relatively new language to me. Whether you want some inspiration to improve your skills like I did or you need to prepare for an upcoming job interview, I would highly recommend AlgoDaily or anything similar. Here is a quick overview of what I learned after 30 days of daily challenges!
I Boosted my Productivity
When I started doing these coding challenges I was suffering from a general lack of motivation in my life. I went to work and completed my projects as expected but was struggling to find incentive to work on personal projects in my spare time. I always loved working on side projects and pushing myself to learn, especially when I was in university for mechanical engineering. Having access to tools and workshops was great for inspiring tinkering and productivity.
Without access to these things I lost that inspiration and thus, did not do much of anything outside of work for over a year. When this project came up it encouraged me to learn something new outside of my job, which had a dramatic effect on my overall productivity. I realised that, while I didn’t have access to fancy workshops or tools, I did have a computer! I was able to draw the same inspiration from coding that I had been missing in my life as of late.
Writing these challenges became a routine for me. I would receive an email every afternoon with a new one, giving me a couple of hours to think about my approach to it while I was still at work. At home in the evening, I would take 30 minutes to 1 hour to hack some code together and try to get it to work. Having a daily reason to sit down in front of my computer to do something other than watching Netfilx was huge for me. Often I would continue working in a productive way after completing the coding challenge, and even started working on mini software projects, unlocking doors that I didn’t know needed unlocking.
I Trained my Programmer Brain
“Everybody should learn to program a computer because it teaches you how to think”
— Steve Jobs
There are plenty of programming courses out there that include course modules on thinking like a programmer. It is an important early step in becoming a computer scientist or a developer.
To me, thinking like a programmer means having the ability to tackle a problem from one angle, then to step back and take different approaches until you come to a solution. Often the first avenue explored will not lead to a complete solution, so you need to be ready to reset from time to time. Even if you come to a solution you need to ask yourself “Can I make this run faster?” or “How can I make this more memory-efficient?”
The first coding challenge I received involved the famous Fibonacci sequence. Each number in the sequence is the sum of the previous 2 numbers, so it goes 0, 1, 1, 2, 3, 5, 8, … and so on. The challenge asked for a function that would return the Nth Fibonacci number. If I asked for the 100th Fibonacci number it should return
The great thing about small challenges like this is having multiple ways to come to a solution. You could, for example, start building a list or array of the Fibonacci numbers up to the input index, N. This would require you to save all of the preceding numbers though, and we only need the last one. It would be better (and smarter) to save only the minimum numbers needed and thus avoid carrying huge arrays in memory if we input a large number.
A Useful Library of Code Snippets Grew
Most of these challenges require a lot of the same thing: building arrays, for loops, condition statements. In Python, I would normally use one of Numpy’s sorting methods, but implementing a cycle sort algorithm from scratch requires lots of list-handling and looping. These challenges are designed to work for any language, so using additional libraries or functions beyond the core basics would kind of be cheating.
After completing several of these challenges I found I was searching the internet a lot less often for basic syntax questions. I was much more capable at setting up and structuring my code without looking anything up, which was very encouraging for someone new to Python at the time. With every completed challenge I was also adding a new snippet of code to my collection for quick reference. Before long I had my own personal library of reference code to pull from if I needed a quick refresher.
My Code got Prettier
While my primary goal was to make a simple script to complete my daily challenge, I often found myself taking an extra 5 or 10 minutes to make my code look better. I knew that I might have to reference it again in the future, so I thought it would be a good idea to clean it up and use good commenting practices. Rather than simply writing a script to meet the minimum requirements of the challenge, I would try to build it into a small command-line tool or do something more creative with it if possible.
I made an effort to push my personal boundaries a little bit more every day as an excuse to learn something new on top of just solving another puzzle. This is how I learned to properly structure and package Python projects, as well as how Python classes and data structures worked in more detail.
It’s Worth Repeating
When I finished my 30 day challenge I was in a much better position to tackle my upcoming Python project. I had useful knowledge in my head and saved in various folders on my PC and GitHub. More importantly I felt a lot more confident in my problem solving abilities when it comes to approaching programming challenges.
Several months later I became interested in the programming language Rust. It is a compiled language similar to C++ in syntax with a super user-friendly compiler and error-messaging system. After some basic tutorials to learn the syntax and core basics, I thought it might be fun to re-write some of my old Python algorithms in Rust — good thing I documented them nicely!
I didn’t redo everything, only the more interesting ones. I found it a great exercise to solidify what I just learned in a few tutorials without taking on a massive software project.
I think if I ever decide to really learn a new language, prepare for an upcoming project with a less-familiar one, or prepare for a job interview, I will try to work a daily coding challenge into my routine. It is a great way to learn or refresh the basics of a programming language and tune your problem solving skills!