People often use the term competitive programming to refer to any activity (besides homework) where programmers create solutions to made-up puzzles rather than real-world problems. For example, consider this Quora question: Which is the best online judge for competitive programming, HackerRank, HackerEarth or LeetCode? As Bohdan Pryshchenko points out in his answer, these three sites focus on interview practice, not competitive programming in the traditional sense. Their questions cover topics likely to come up in an interview. And although some of them host contests, those contests don’t consistently attract the strong contestants who regularly show up for Codeforces and Topcoder events.
When I’m writing Quora answers, I sometimes point out the difference between competitive programming and interview preparation if it’s relevant to the question. But while I’m always in favor of using terms correctly, I’m not sure how important this distinction is in the scheme of things. Consider that:
Coding interview questions require knowledge of topics like graphs, trees, and dynamic programming algorithms, all of which are used in competitive programming.
Participation in competitive programming tapers off quickly as the problems require more advanced algorithms. For example, see the bottom graph in this Quora answer. Red coders on Topcoder are a long tail at the high end of the rating distribution, while the bulk of the contestants are clustered in the large gray-green-blue area. At these levels, competitive programming questions use well-known algorithms, just like interview questions do.
Competitive programming owes most of its popularity to its association with coding interviews. If it was just about coders solving puzzles, it would be a niche activity even within the software engineering world.
A Project for 2020
So coding interview sites can provide many of the same benefits as competitive programming sites, unless you need to focus on advanced topics. With that in mind, my project for 2020 is very simple: coding on HackerRank. I’ve been trying the site out in recent months, and I find it quite convenient to use. The online IDE works well for basic problems, though I switch to Visual Studio if I need to do a lot of debugging. There’s a good mix of easy, medium, and hard questions, and even the hard questions don’t require obscure algorithms. And the focus on interview topics provides the benefits of solving coding puzzles plus the practical advantages of interview preparation.
My choice of HackerRank for practice is somewhat arbitrary. These days people often think of LeetCode when they’re looking for coding interview prep sites. I have tried both sites, and they’re both good. They both have a free offering, so you don’t have to commit to one or the other. I’m mainly looking for a practice tool that’s more modern than the one I have mainly used in the past, UVa Online Judge. One point in favor of HackerRank is its cleaner UI. For example, when you’re logged in, the HackerRank home page shows the practice dashboard, while the LeetCode home page shows “Trending Posts.” So in that way, HackerRank is more focused on the primary goal, which is practice. But like I said, they’re both good.
My yearly projects have always had a coding (or math) component combined with a writing component, the weekly blog post. For this project, I’m changing how I do the writing part. Rather than write a weekly article tied to the project, I’m going to continue what I started last year, and focus my writing on one or more weekly Quora answers. These answers may draw from things I’m learning in my project, or they may not.
I’m continuing the Quora approach this year because it worked well in the second half of last year. Compared to blogging, there’s more opportunity on Quora for readers to engage with posts, send questions through the answer request system, and generally participate in a community. That seems to be the way things are now with online writing. As I did last year, I’ll publish a weekly blog post with links to Quora answers. And I may write the occasional blog-only article when I have an appropriate topic.
(Image credit: I took this picture looking up from inside the Ada installation, which was created by designer Jenny E. Sabin)