Where to practice algorithms online
If you are a programmer you probably know, that algorithms are a very important part of programming. University courses, online courses or books are, among others, ways to learn about algorithms. However, it is much harder to practice algorithms in order to really get a grasp on them in a fun way. This post will talk about some of the web apps I have used to practice algorithms and improve my problem solving skills.
The apps are very similar in how they work. You get a description of a problem (sometimes multiple paragraphs) and then you either get a editor in which you can type your code directly. Or you get a text box to either enter your answer or paste the code of your solution. The apps allow you to run some basic tests before submitting your solution. After you submit your solution, it is tested on an advanced test set (edge cases, large numbers, wrong inputs, …). They then show you a result of how well (or bad) you have done. Since these are training sites, you can usually go back and edit your code even after submitting.
My favorite apps for practicing algorithms
Project Euler
Mathematical problems, gets more and more difficult
Project Euler’s beauty is in its simplicity. You get a problem and underneath you have a text box where you can write your answer – mostly just a number. The first few problems are very easy but they start to gain difficulty pretty fast. I tried checking my account and I was a bit disappointed to find out, that I have only gotten to problem number 12. However, if you are a beginner programmer, even the first few problems will be a great exercise.
CodeSignal (CodeFights)
Gamification, various difficulty levels, daily challenges, community
I have discovered this web app when it was starting out I think. The initial concept was, that it would match you up with a random player from around the world and you would have a code fight. This means, that both of you would get 3, mostly easy, tasks to solve and you would get scored based on how fast you solve those tasks. The fastest one wins. This was actually pretty exciting because you could see how fast the other player was progressing and you would feel under pressure to be faster yourself.
This concept was however changed after a while, because it probably wasn’t a great way to make money (that is just my assumption). They rebranded to CodeSignal and the main point of the app now is recruitment (as with most of these apps). They try to help companies find capable programmers.
Even back then, when code fighting was the main point of the site, there were also daily and weekly programming challenges. The challenges were slightly more difficult problems that took anything from 5 minutes to an hour to solve. You could (and still can) try out some tasks that were said to appear in interviews for big tech. There is an interesting arcade mode, in which you simply advance through programming problems. You get some points and achievements for solving the problems. These problems are not too hard, which enabled me to keep it up longer, as I wasn’t getting demotivated. You get some points for solving a challenge and you also gain badges for various accomplishments. This makes it feel at least a little bit like a game.
I was very sad to find out that the original code fighting functionality has been completely removed from the app. Or at least I wasn’t able to find it anymore.
Feel free to checkout my profile.
Codility
Proffesional, harder challenges, requires some algorithmic knowledge, used at interviews
This is more of a pro platform than CodeSignal. I think this is what CodeSignal would eventually like to become. It has a pretty good evaluation software, which tries to tell the complexity of your algorithms and evaluates you also based on that. The challenges on this site require more deep knowledge than the challenges on CodeSignal. They require you to actually know some of the algorithms or at least the possible ways of solving a problem (dynamic programming, greedy algorithms, …).
Codility is used by some companies in their hiring process. Toptal for example uses this platform for interviewing candidates. This is also a good reason to try and solve some of the challenges provided by this app.
Another great thing about Codility is that it provides some material to learn (or at least hint) how to solve the tasks in a given section. This is great, because it enables you to not only practice algorithms, but also learn them. These materials alone aren’t however enough to be able to solve the problems. As I said, you need some algorithmic knowledge to able to solve most of the challenges.
Codeforces, TopCoder, HackerRank
Competitive programming, very hard problems, communities
These are some other sites that I know of, but I haven’t had the chance to try them out. I did solve some problems on CodeForces, which is a competitive programming oriented app. They pretty much work the same way as the previous apps I have mentioned and also provide mostly very similar problems.
Final note
What I like about these apps is that they provide fast feedback on your solution. You can progress very quickly, which is much better than waiting for a professor or someone else to rate your solution. This means that you get to practice algorithms faster. You also get the chance to correct the solution if you have provided a wrong one. This is great because you mostly don’t get the chance to do that at exams or something like that. They are also beautifully done, which just adds to the whole experience.
If you are looking for some other ways to improve as a developer you might want to check out this podcast episode (in Slovak).