If you’ve ever tried a programming challenge, then you know they are fun and addicting.
But they’re more than just fun – they also help you become a better developer.
Over the past few years, I’ve done hundreds of programming challenges. I’ve noticed the regular practice has made me a smarter, faster, and stronger developer.
In this article, I’ll explain how you can do the same:
- First, I’ll explain why programming challenges help you become a better developer.
- Next, I’ll recommend how you can get started with programming challenges.
- Finally, I’ll wrap up with some tips and tricks.
Get ready to get challenged!
Why Programming Challenges Work
To understand why programming challenges work, first you need to understand muscle memory.
Think back to when you were first learning how to drive. At first, it required your complete focus. You had to think about how fast you were going, worry when you were parking or merging into traffic, and so on. But now, you can drive while talking with someone and even singing your favorite song!
At first, performing an unfamiliar action takes focus. But if you practice enough, you can preform the action almost without thinking.
That’s muscle memory: knowing how to perform an action without conscious effort. And you can develop muscle memory for programming tasks too!
Programming as a Muscle Memory
Think back to when you first started programming on a new platform. It took a lot of effort at first, right? Often you needed to look up method names, read documentation, and so on.
But after a while, you developed muscle memory, and are now able to write code off the top of your head.
Consider a few other common programming tasks:
- Creating a singleton
- Using reduce to transform an array into a scalar
- Handling errors and exceptions
When you first try these things, it can often be time consuming or confusing. But if you practice it enough, you will build a muscle memory with the solution.
At this point, you won’t need to think about how to solve the problem anymore. it will just become a normal routine when writing code.
This explains why programming challenges work. They give you opportunities to build muscle memory, via practice on common development challenges.
That way, the next time you need to solve a similar challenge, you’ll have a solution ready! This helps you be efficient and allows you to focus on larger problems, rather than the small details.
How To Get Started with Programming Challenges
Ready to start building some muscle memories? Luckily, there are some great sites out there offering programming challenges.
Here’s what I consider the best. I recommend you pick one that sounds interesting and give it a shot!
HackerRank, formerly known as Interview Street, is a platform offering coding challenges, usually in the form of algorithms to implement. I love its slogan: “Your most productive distraction“.
On HackerRank, you’ll find:
- Domains: A selection of problems to solve, categorized by type (algorithms, mathematic, AI, and more) or language.
- Contests: Time-limited challenges where you’re challenged by a set of problems grouped by a common subject that must be solved within a predefined timeframe.
- Rank & leaderboard statistics: See how you’re progressing compared to others and which achievements you’ve earned. A nice feature in the leaderboard is the ranking, grouped by complexity level (O(1), O(logn), O(n), and so forth), which helps with figuring out the average complexity of each user’s solutions.
Big O notation: What is it? It measures the complexity of an algorithm, and it’s used to figure out the expected processing time depending from the problem size.
It usually makes sense when the algorithm performs one or more loops, where the number of iterations is in strict relation with the input size.
For more details, check out our Collection Data Structures in Swift article.
Employers use time-limited challenges on HackerRank to evaluate potential candidates’ programming skills and problem-solving abilities with any of its available languages.
Note that employers can choose to reduce the list of available languages — I presume that a company looking for an Android developer wouldn’t be interested in a candidate who excels in Swift development. Well, at least not today. Tomorrow, who knows? :]
I recently participated in a screening process after getting an invite from Amazon — yes, that Amazon. :] The coding experience was pretty good and the available time was reasonable; I finished it in 1:58, just two minutes shy of the two-hour time limit.
Although the environment includes a web-based editor where you can write code and test, I always prefer a local, desktop-class IDE. In this case, I opted for CodeRunner, a coding editor that supports several languages and capable of compiling and running directly from the IDE.
To some extent, it’s similar to Swift playgrounds. The list of available languages and environments is pretty long — 45 in total — which includes new, old, OO, functional, imperative, shell, DB, and so forth. Just to name a few:
Among all the services reviewed in this article, MathFights is the only one where you don’t code. Actually, it’s not even about programming. As its name suggests, it’s about math challenges that are usually served as 1:1 fights.
Why mathematics? Well, this article is about keeping your brain sharp, and solving math problems does that. Practicing mathematics gives your brain elasticity.
Moreover, you use math daily as a developer, so being able to do calculations quickly can help in your daily life.
How it Works
You start a fight with a click of a button, then you’re matched with a random opponent and the fight begins!
You and your opponent are presented with one question at a time along with a list of potential answers. Your challenge is to determine the correct answer in the shortest possible time, staying within the predefined time limit.
Each question has a winner and loser; the winner is whomever chooses the right answer in the least amount of time. For each round, you and your opponent get a score. At the end of the fight, the player with the highest total score wins.
Pro tip: Keep some paper, a pencil and maybe a calculator nearby because you will have to calculate.
Math problems come in different shades of complexity, so MathFights uses divisions to group questions by difficulty. Division 1 hosts the simplest problems and is where you start. After a certain number of wins, you’re promoted to the next division. Look out: you’ll get a downgrade if you lose too many fights.
You can also create public or private tournaments, which is very handy when you and some friends want to engage in some friendly, intelligent competition.
Lastly, there’s a practice section where you can just solve problems without the pressure of a real opponent. It’s just you against yourself and a clock.
In my personal opinion, MathFights is undeniably addictive and remarkably useful. I used to spend a lot of time on it. One day I realized that it was becoming a distraction, so I decided to stop. This was after reaching division 7. Incidentally, I don’t know that I could have progressed much further. Staying there without getting a downgrade was pretty hard.
TopCoder was the one of the first (if not the first) service to offer coding challenges.
Whereas similar services offer explicit recruitment services to customers, or don’t have a business model at all, Topcoder has a few models that are probably unique in this area.
You, as a developer, can solve challenges, but can also participate in events that are somewhere between a paid gig and a contest. In fact, companies can create an event if they need fresh ideas for development projects, such as:
- UI/UX design
- Application development
Candidates compete to win a payment from the company. As you might expect, there’s a lot of competition, and usually only one winner per project. On the bright side, it’s absolutely an excellent way to test your capabilities on a real, tangible project.
The list of companies you might potentially work for are respectable names, such as:
There are also recurring tournaments, single-round matches and other contests, some of which allow or require teams. If you opt for a team contest, you collaborate with others in a hackathon-like format to solve a problem.
There’s a lot more to TopCoder than can reasonably be discussed here — covering it all would monopolize this article. Have a look, explore, then feel free to talk about what you find in our forums!
CodinGame is about coding games, but it’s not a freeform blank sheet of paper where you have to invent and draw your game.
Don’t let the presence of the word “Game” fool you into thinking this is a casual site — it’s not. It is, however, a unique way to stimulate your brain. In coding game you’re given:
- A game plot
- A scenario
- Some actors
- A goal
Your task is to write the AI. Pretty awesome and interesting, eh?
The site provides all the graphics, animations, effects, scenography, etc. CodinGame is a bit like being on a movie set where you’re the director; you write your script to control your actors, and then you watch them execute that script.
The list of languages is pretty long — 25 in total. For you Apple Developers, there’s Objective-C and Swift.
How does it work? You have a browser-based IDE, and it’s a full featured build that includes a:
- Code editor
- Console output
- Help panel that has a description of the problem to solve
- List of test cases
- Action area, with buttons to run tests, start the simulator, submit your solution, etc.
The editor comes prepopulated with some skeleton code and a clear indication of where to write yours. Once you’re done coding you start running test cases.
When running a test case, the simulator actually shows the game with the AI-controlled actor following the orders you gave with your code. By the end of the simulation you know whether the test passed or not. If not, most likely your actor was killed. :]
CodinGame provides you with a rare opportunity to watch your code come to life — and it’s as amusing as it is stimulating. If you like games and coding, then this is the place to be.
Following an established pattern for coding challenge platforms, CodinGame also offers services that are designed for companies that want to hire candidates.
Now tell me: when you’re looking for your next job, which of the following two would you choose to show your expertise?
- An option to write code to implement a linked list on a “cold” white board
- An option to write AI for a bot whose goal is to kill its enemies that lets you use your browser for your IDE
The choice is clear. Killer AI bots are always the better choice for showing off your skills. :]
As soon as you land to the CodeFights, you immediately notice the appealing superhero avatars. Disappointingly, you can’t use them for your own profile — they’re just there for looks.
However, the site is not about cool avatars; it’s about coding and debugging.
Once you’ve registered, you’ll get an invite to a 1:1 fight with a bot. It’s pretty easy — any developer with 1 day of experience should be able to win the fight.
Each challenge consists of a three-round fight, and there are three types of challenges you need to solve:
- Debug: you’re given some code and must locate and fix the bug
- Recovery: you’ve given some incomplete code and must fill the missing part
- Code writing: you implement a function from scratch
Each round comes with a description of the problem to solve.
One downside of this otherwise useful service is the restricted list of languages. There’s also no Swift or Objective-C, so iOS and macOS developers may feel some disappointment.
On the upside, you have its browser-based editor that sports autocompletion and smart navigation — you can use CTRL + left or right arrow to move to the previous/next word, even with camel case identifiers.
Besides battling bots, what else can you do on CodeFights?
- Fight against real people — either friends you invite or random opponents
- Join marathons
- Participate in tournaments
- Challenge company bots (Dropbox, Uber, Asana, Quora, and more), which can help you get noticed and maybe even hired
- Create and submit your own challenge
CodeEval seems like a front end for a recruitment business. While that’s not entirely a negative thing, it is the feeling I got after registering and accessing to the dashboard. But that’s just my subjective take.
Once in the dashboard, I spent some time wondering what to do next. Unlike the other services reviewed here, there’s no guidance and no “check this” nor “do that” kind of UI. You have to explore on your own.
The number of available languages is 26. You won’t find Swift, but Objective-C made the cut. Besides the dashboard, which looks very nice, the rest of the experience is a little spartan.
The editor is suitable. It has auto-complete, but the comment font color is a little difficult to read. Copying and pasting into an external editor is highly recommended.
At CodeEval, there is only one type of challenge: you versus yourself. There are three lists of challenges that are divided by difficulty.
Another potentially useful section is the “Jobs & Offers” page. Here you can find job offers, some of which require you to solve a problem in order to apply — most likely, it’ll require coding. The rest of the posts are more traditional, static job ads.
Advent of Code
There are two things that I really love about Advent of Code:
- Interface: it looks like an old, green phosphor monitor
- Challenge result: you don’t have to submit your code — you just write the solution
Rather than having an IDE, a list of available languages, complexity, Big O notation, and so forth, Advent of Code just asks you to provide an answer to a question.
How you find the solution does not matter. Nobody cares what language your work in or how efficient your algorithm is. Advent of Code offers complete freedom of choice.
Alternatives to Online Challenges
Challenges are fun and fulfilling but not the only way to keep your brain sharp. There are other ways to stimulate your brain! Here are some of the best:
- Hackathons: Sure, you’re solving problems, but you’re also fine-tuning your collaboration skills, which is vital for success. While you’re at it, you’ll probably also compete with your colleagues in subtle ways and pick up some new tricks. You might even find your next employer this way! A word of advice: they burn hot and fast and can be quite exhausting. I don’t recommend doing a hackathon every day — or week for that matter.
- StackOverflow: Real people are very creative when it’s time to solve real problems. Not only can you get help when you’re stuck, but you can help others when they’re stuck. By participating, you’ll learn a lot and increase your fluency with the language(s) of your choice.
- GitHub: What is there to say about this really? There’s just too much to discuss here in this review. To learn and challenge yourself, just pick a project and start coding.
Tips and Tricks
I’d like to wrap up with a few tips and tricks.
Competition and You
As you may have noticed, many of these programming challenge sites are competitive.
As humans, we’re naturally competitive. We compete on almost everything:
- Catching the eyes of a special somebody before your friend does
- Landing a job
- Sitting in the front seat of a car
- Having the TV remote
Competition often drives us to try harder than we would otherwise. This can be great when you’re trying to improve your coding skills.
But there are a few gotchas about competition I’d like to point out.
Competition is Not for Bragging
Competition is a tool to improve yourself, what you’re working on, and the people around you. It is not a way to prove you’re superior.
Having this attitude can cause significant problems in the workplace, as Sarah Mei notes:
So remember to stay focused on self-improvement, not superiority. As Swift team member Gemma Barlow said, “…friendly rivalry is always good as long as you’re striving to create a better product for your users”.
Competition has a Time and Place
Another thing to note is competition isn’t always the proper solution.
Unity team member Barbara Reichart said that she prefers the following:
- When learning new things, she prefers to use cooperative environments. This way, when you’re learning you can be in a low-risk environment and can take your time.
- When trying to become great at things you already know, she prefers competitive environments. This way, you can have a fire lit under you to drive you to the next level.
Finally, Gemma points out that competition isn’t for everyone. “It’s good to acknowledge that not all personality types thrive in a competitive environment, and there are other ways to keep your brain sharp.”
So remember – competition is a tool, and deploy it only when appropriate!
Take some Rest
These programming challenge sites can often be addicting, as I know from experience!
But be sure not to overdo it – your brain can only take in so much at a time. It’s better to be consistent and space it out.
Gemma put it well: “I would prefer to be getting some sunshine and resting my brain rather than continuing to stress it”.
That’s a good piece of advice. Don’t expect too much from your brain after you use it all day long. Would you expect your legs to run all day or your arms to do pushups nonstop?
Give it a break and let it relax, from time to time. Just don’t abuse it.
Where To Go From Here?
I hope that I’ve convinced you to give programming challenges a try!
Note there are more great places for programming challenges beyond what I’ve covered here. This article focused on those that I’ve used so that I could speak from experience.
I asked our readers what other sites they recommend, and they gave the following list:
Remember, although traditional learning and a challenging workplace are valuable tools, they’re not enough.
To be the best developer you can be, you want to build your muscle memory. You should look outside your comfort zone and work with unfamiliar tools and problems. That’s what programming challenges are all about!
I recommend you take a site mentioned in this article and give it a shot! Whatever you choose, what’s most important is that you do it regularly.
That’s it for now. If you have any questions, comments or suggestions, please join the discussion below!
raywenderlich.com tutorial team members:
- Foster Bass
- Lê Trí
- Marius Horga
- James Hall
- Nick Mayfield
- Michal Ciurus
- Kuba Suder
I may not have quoted everybody, but trust me when I say that their input helped me a lot shaping and giving this article a direction!