Disclaimer: I am a fan of HackerRank’s contests and wide range of problems across languages and domains. Here I discuss two ways CodeWars is better than HackerRank. (Both are sites where you can do programming problems competitively.)
Theme: CodeWars is better for beginner – intermediate learning.
CodeWars emphasises testing throughout.
- While you’re working on the problem, there is a code window dedicated to testing. It includes several basic test cases which are especially useful for users who are just starting out or who are not familiar with testing or test-driven development.
- CodeWars shows you which test cases you failed and how you failed. This makes it easier to pass the tests. This arguably makes it too easy because you can see exactly how your code fails, but I think it’s good for learners who otherwise might just give up.
- HackerRank gives testing more of a back seat. It usually only shows you one basic test case and does not make it easy to see which real test cases you failed and how you failed them in the window. It is also more of a hassle to upload your own test cases.
- In CodeWars, you can also refactor (improve) your code once you’ve passed all the test cases before you make your final submission. So you can check if your brute force version passes all the tests before making it prettier.
- Your prettier answer is then made public for everyone to see and up-vote. This is fantastic because everyone gets to see the best answers.
Codewars encourages you to learn from other users’ answers.
- CodeWars shows you others’ up-voted clean and clever answers after completing each challenge (Kata) so you can immediately learn from the best answers. On HackerRank people’s answers are not shared unless they post them in the Discussions section.
- I learned more from examining a few good examples than from reading online tutorials. It’s especially effective when you compare others’ answers to your own and pick out how your answer is worse (or better).