Autumn term is the time most university students apply for summer internships, and if we are lucky we will either be called for interviews during this term or during the next term. For computer scientists like myself (and some engineering students), these interviews are are likely to feature a a segment that tests our coding ability, especially if we are applying for a software development role. Coding interviews are known to be unpredictable and often feature very challenging problem-solving tasks. On account of this, it’s important that candidates prepare, and the best way to do this is by practising problems, which test their knowledge of algorithms and data structures.
There are a number of websites that offer coding practice resources. I will be reviewing three of them in this article: LeetCode Online Judge, TopCoder and HackerRank, but I will also include links to other useful sites at the end of the post.
Top Coder is an established and well-respected competitive coding website. Employers such as Amazon, Facebook, IBM, Microsoft and Salesforce use the website for crowdsourcing. The website also hosts hackathons where users can compete against each other for cash prizes. What I like about Top Coder is that it gives you the option of registering with their GitHub accounts, as well as the usually options of creating an account with them or using your Facebook or Google accounts, but this is not a unique feature and many competitive coding websites offer a similar registration option. There is also a wide range of content on website, however this can also make it tricky to navigate and find out where to go for algorithm and data structures revision. I would advise starting with the Single Round Matches: Practice Problems.
In this section problems are classified by difficulty (easy, medium and hard), which determines their points-value. Clicking on a problem opens up the problem area, which gives you a description of the problem, a list of constraints, test cases and other useful information for solving the puzzle. TopCoder also provides an editor, which supports Java, C++, C#, Visual Basic and Python. Note: you will most likely need to expand the coding area to view all the language and line numbering options on your browser.
HackerRank boasts a database of over 800 problems and support for over 30 programming languages. Like TopCoder it also allows users to log in using their GitHub account, but the logging in/registering process is a lot quicker. I think the website itself has a great UI overall. When you first log in, you are asked to pick areas of interest so that you can target your coding practice. This is a great feature, though the sheer number of options can be slightly overwhelming!
Users have the option of selecting problems from a multitude of domains, these could be topics like mathematics, algorithms and data structures, or languages like Python, Java and C++. This allows you to hone in on the topics with which you feel less confident. There are also a number of warm-up excises to ease you in. As the name HackerRank suggests, the more problems you solve the more points you earn, and these points are converted into a rank, which gives you an indication of how well you are performing compared to all the other competitors on the website.
Last but not least there is LeetCode. This is website I regularly use for my interview preparation. I like it because it is simpler and not as “busy” as HackerRank or TopCoder. There are not as many problem sets as either of the other two websites, and some of the problem sets are only available to paying customers, but I still think that there are enough challenging problems for an interview candidate to sink their teeth into. Also, the problem statements are not as long-winded as those on TopCoder, and in my opinion as the problems are more in line with the questions you are likely to be asked in a coding interview. Furthermore, it’s not necessary to register an account in order to use the website’s resources.
In summary, I would say that there are no better or worse coding websites, some are simply better suited to a specific purpose. If you are interested in tackling challenging problems, but don’t want to be given too much guidance I would advice trying LeetCode. For more more niche topics I would recommend HackerRank, and if you are interested in longer and rigorous problem sets TopCoder is the best site for you.
Resources mentioned in the blog post
- Hughes, J et al. (2015). TopCoder. [online]. Available from: https://www.topcoder.com/ [Accessed: 21/12/2015]
- Ravisankar, V et al. (2015). HackerRank. [online]. Available from: https://www.hackerrank.com/ [Accessed: 21/12/2015].
- Unknown (2015). LeetCode Online Judge. [online]. Available from: https://leetcode.com/problemset/algorithms/ [Accessed: 21/12/2015].
Other useful resources
- Miller, B. Ranum, D. (2011). Problem Solving with Algorithms and Data Structures Using Python. [interactive e-book]. 2nd Edition. Runestone Interactive. Available from: http://interactivepython.org/runestone/static/pythonds/index.html [Accessed: 21/12/2015]
- GeeksforGeeks (2015). GeeksforGeeks – A Computer Science Portal for Geeks. [online]. http://www.geeksforgeeks.org/ [Accessed: 21/12/2015]