Table of Contents
What is hackerrank and what does it offer coders/programmers
HackerRank is a free online platform that offers programming tests and a CV/resume database for programmers. The whiteboard application for HackerRank allows developers to show their skills in real time and to work on coding problems from any device. Coding problems are developed by the HackerRank team to test programmer skills. While a majority of the questions in these programming whiteboard competitions are technical, there is no coding or programming prerequisite. The programming problems can be solved by anyone with a background in any language and technology: Java, C++, Python, JavaScript, HTML/CSS/LESS or SQL.
HackerRank is a platform designed to help companies discover talented programmers, and to help programmers find a job.
The platform was launched in 2012 but the company roots date back to HackerEarth, a social coding community that was founded in 2010. In 2013, the company acquired CodeEval and incorporated its unique algorithms and live contest competitive programming platform into HackerRank. In February 2014, the company raised $11 million from Bessemer Venture Partners and Matrix Partners India.
HackerRank has helped many programmers find jobs since 2012. For example, in June 2013, a developer named Marla was hired by Google after participating in the Google Code Jam online coding contest.

My experience with the whiteboard coding challenge
I started programming in 8th grade (around 2005–2006) when I decided to make a website with my best friend. We wanted to create a social network, but we had no idea how to do it. That’s when we decided to use PHP and MySQL as the technologies for our website. We read the documentation and searched for tutorials on the Internet, but instead of learning how to create a website, we ended up learning how to create our own database. With that being said, we were two junior-high school students who had an overwhelming passion for programming — even if it was in PHP. In 9th grade, I took AP Computer Science, where my teacher was a very nice woman who was now teaching computer science at the high school. We were taught how to program (in Java) in a very abstract way by using the ideas of Object-oriented programming.
It’s important to note that we didn’t have computers in our classroom and everything had to be done on paper, which was extremely time consuming since my teacher wanted us to get as close to actual coding as possible — we weren’t allowed calculators. Thus, the exercises were written on the whiteboard and we were required to type them into a computer. I personally think this was an interesting way of exposing the fundamentals of programming.
How to approach the problem and some tips/tricks
When I first stared at the problem, my mind went blank. I had absolutely no idea how to approach this problem. Then, when I saw the time of 4 minutes for the competition, I was a little worried about finishing it. The worry was unnecessary — even though it felt a little rushed, I finished the problem with about a minute left to spare.
In case you don’t already know, the problem is to write a function that computes the number of bits in a given input.
For example, if we want to find out how many bits are in the number “29”. Here’s how we would do it.
First, we write 29 as binary.
Next, we get the sum of powers of 2.

The solution that I came up with and a brief explanation of my thought process
The problem I solved was a simple SQL query. In addition, I had to change the logic slightly as I noticed that the datastore contained records of students who finished their classes in 2008 — but on that year there were no records. To fix this, I had to check each student who finished their classes in 2009, 2010, 2011 and 2012 on the table StudentID and if their class year was valid for that table. I used a where clause to verify that the year of the class was accurate on the record itself.
I read the question and got to work writing the SQL query. First, I took a stab at the logic by writing an if statement.
if Year == 2008 Then
I ran into some errors in this code — which suggested that I should widen out the query. After having troubles making this work, I finally realized that I needed a where clause.
I put the code into a query and found that it executed without errors:
Dim year As String = 2008 Dim Id As Recordset = db.OpenRecordset(sqlText, dbOpenCmds, conn) where Year like “%2008%” Select * From Student where Id = ID End Function
Some general thoughts on the challenge and how it could be improved
The whiteboard coding challenge is a fantastic way to get job experience in front of potential employers and to display your knowledge and abilities as a coder. While this coding challenge seems pretty straightforward at first, it’s actually quite difficult. The harder and more complex the problem, the better. This is because it shows your competency in solving problems by using your knowledge of both mathematics and programming. This challenge is a bit too simple. An algorithm to solve this problem should be able to accept any number of zeros and only calculate the factors up to the largest number given.
The largest number should be at least 1000, but it really depends on how advanced you’d like the challenge to be. Ideally, this would allow you to solve more than one problem just by multiplying a single value. For example, one problem could be multiplication and another could be division; an algorithm that can perform both calculations is ideal.
