I’ve used both platforms pretty extensively to beef up my data structures and algorithms knowledge.
Tons, and I mean tons, of questions and organized into Tracks. Want to learn about how to use Regular Expressions/ Java/ SQL/ Algorithms/ Data Structures/ Python/Math? Each one of those topics and more have specific paths with specific sub topics.
If you are using these sites to get interview prep, a lot of companies send their coding challenges through Hacker rank as apart of the interview process, so it’s good to get familiar. Expedia, GE, Goldman Sachs and Optiver to name a few.
You get almost all functionality (if not all) from the website for free. On Leetcode without the paid subscription, there are definite drawbacks.
For instance you can’t always submit your solution right away, due to how they run the solution to rank against all other solutions.
Almost all problem statements have examples of 1 or 2 test cases and answers and pretty thorough explanations of why the answer is the way it is. That’s much less common on Leetcode.
Every question posted on Hackerrank has a verified solution on the “Editorial” tab. Not every Leetcode question has one ( Though you could easily get an answer on both platforms clicking on the “discussions” tab)
Both sites have visible test cases to run your code with before submitting. Hackerrank does a pretty good job of making those visible ones the common cases, while Leetcode almost always uses an edge case for the visible test.
Hackerrank has vim bindings! (If you’re into that)
Also Read Best ways for B2B Lead Generation
Something I love about Leetcode is that they have straight to the point problem statements. Hackerrank tends to have a bit lengthy introductions and drawn out scenarios that mask the actual task.
For example: Hackerrank could be like “Sally loves chocolate but only wants to eat chocolate with the lowest amount of sodium. Given an array of sodium levels, return the lowest chocolate with lowest sodium”
Leetcode equivalent would be “Given an array of integers, return the min element”
Both Hackerrank and Leetcode compare the run time costs of your algorithm by timing the solution with test cases. However, once your solution has been approved, it lists it against all approved solutions in the same programming language and the percentage of how many solutions you beat out for speed.
The testing environment is far superior. When you enter a custom test case it also runs the correct solution too so you can immediately know if your’s is right or wrong. On Hackerrank, running a custom test case only runs your solution.
Another thing I love, for every problem, the coding interface requires only working with some predefined function signature. In Hackerrank, a lot of the time you have to handle the input/output, and it runs string matching to validate the answer which can get a little annoying
Seriously… why I should print “YES” or “NO” when the quicker equivalent is just keeping a Boolean object?
Leetcode has that fancy “Question was asked by X Company with Y% frequency”, that you can access with the subscription. I personally think that this tool isn’t that useful, and gives false impression that people can just memorize all those specific questions once they get an interview with X company.
My choice from HackerRank and LeetCode
I personally like LeetCode better and, ultimately, it comes down to what you’re using it for.
These are my opinions of what the strengths and weaknesses are. While some people may view that a weakness is really a strength and vise versa.