Preparing for a HackerRank hiring test
HackerRank is the screening tool of big tech, banks and consulting firms. Its tests are longer and more algorithmic than CodinGame's. Here is how to approach them.
A HackerRank hiring test lasts 60 to 120 minutes and usually contains 2 to 4 coding problems graded by hidden tests, sometimes with MCQs or a SQL question. Difficulty ramps up quickly: 'medium' problems require the classic data structures and reasoning about complexity, because hidden tests include large inputs that time out naive solutions.
How a HackerRank test runs
You get an invitation with a window of several days and a fixed duration, to be completed in one sitting. Problems are listed in a left-hand menu; you can switch between them freely and come back.
Each problem describes a function to complete, with the input format, the constraints (maximum sizes) and two or three samples. Visible tests are only a fraction: the grade comes from hidden tests, some of them with very large inputs.
Many campaigns enable proctoring: webcam, tab-switch detection, copy-paste logging. Plan a quiet room and a stable connection.
The problem families to know
Arrays and strings: sliding windows, prefix sums, frequency counting, anagrams, palindromes.
Hash tables and sets: pair finding, deduplication, grouping.
Sorting and binary search: intervals, k-th element, search in a sorted array.
Stacks, queues and linked lists: balanced brackets, expression evaluation, list reversal.
Graphs and trees: BFS/DFS traversal, connected components, unweighted shortest path, tree height.
Dynamic programming for senior roles: subsequences, knapsack, grid paths.
SQL: joins, aggregations, window functions (ROW_NUMBER, RANK), usually on a two- or three-table schema.
Why competent candidates fail
Time limit exceeded. An O(n²) double loop passes the samples and fails hidden tests with 10⁵ elements. Read the constraints before writing: n ≤ 10⁵ means O(n log n) or better.
Integer overflow in Java and C++: sums and products beyond 2³¹. Use long / long long as soon as the statement mentions 10⁹.
Output format. Like CodinGame, HackerRank compares output character by character.
Poor time allocation. Two fully solved problems beat three half-done ones; but an untouched problem scores zero, so at least attempt the naive solution everywhere.
A two-week training plan
Week 1: one 'easy' and one 'medium' problem a day from the Algorithms or Data Structures tracks, reading the constraints before coding. Time yourself: 20 minutes for an easy, 35 for a medium.
Week 2: target your gaps (often graphs and dynamic programming), then take two 90-minute mock tests. After every failed problem, read an explained solution and redo the problem the next day without looking.
If the job ad mentions SQL, add a set of queries a day: SQL questions are quick points.
Practising with Coding Solutions
On a HackerRank practice problem, the Coding Solutions extension reads the statement on screen and gives you the approach, the complexity implied by the constraints, and commented code in your language. It is the fastest way to understand why your solution times out and how to make it linear.
For algorithmic basics, our explained CodinGame solutions cover the same ideas (search, sorting, BFS, simulation) with the reasoning spelled out.
Frequently asked questions
What is the difference between HackerRank and CodinGame?
HackerRank is more algorithmic and longer, with strict performance constraints and often proctoring. CodinGame mixes more MCQs and short exercises. International companies tend to use HackerRank, French ones CodinGame.
What does 'Time limit exceeded' mean?
Your program is correct but too slow on a large input. You need to reduce the complexity: replace a nested loop with a hash table, a sort or a binary search.
Can I use an external IDE?
Yes, nothing prevents writing code elsewhere and pasting it, unless the campaign says otherwise. But HackerRank's editor logs pastes, so stay consistent with what you can explain in the interview.
Can candidates see their HackerRank score?
Usually not: the recruiter sees the details, you only get a submission confirmation. Some companies share the score on request.