Which Country Would Win in the Programming Olympics?

Update: This article has been picked up by the Washington Post, Business Insider, eWeek and InfoWorld.

Which countries have the best developers in the world?

Many would assume it’s the United States. After all, the United States is the home of programming luminaries such as Bill Gates, Ken Thompson, Dennis Ritchie, and Donald Knuth. But then again, India is known as the fastest growing concentration of developers in the world and the hackers from Russia are apparently pretty effective. Is there any way to determine which country is best?

We decided to examine our data to answer this question: which countries do the best at coding challenges on HackerRank?

At HackerRank, we regularly post tens of thousands of new coding challenges for developers to improve their coding skills. Hundreds of thousands of developers from all over the world come to participate in challenges in a variety of languages and knowledge domains, from Python to algorithms to security to distributed systems. Our community is growing every day, with over 1.5 million developers ranked.

Developers are scored and ranked based on a combination of their accuracy and speed.

According to our data, China and Russia score as the most talented developers. Chinese developers outscore all other countries in mathematics, functional programming, and data structures challenges, while Russians dominate in algorithms, the most popular and most competitive arena. While the United States and India provide the majority of competitors on HackerRank, they only manage to rank 28th and 31st.

***

We began our analysis by looking at which test types are most popular among developers. HackerRank developers can choose to participate in 15 different domains, but some are more popular than others. The following table shows the proportion of completed tests that come from each domain.

The most popular domain by far is algorithms, with nearly 40% all developers competing. This domain includes challenges on sorting data, dynamic programming, and searching for keywords and other logic-based tasks. For algorithms tests, developers can use whichever language they choose, which may partially explain why it’s so popular. Algorithms are also crucial for coding interviews, so it could explain why more coders would practice algorithm challenges. At a distant second and third, Java and data structures coming in at about 10% each. Distributed systems and security are our least popular tests, though we still receive thousands of completed challenges in those areas.

So based on these tests, which country has the programmers that score the highest?

In order to find out, we looked at each country’s average score across all domains. We standardized the scores for each domain (by subtracting the mean from each score and then dividing by the standard deviation; also known as a z-score) before finding the average. This allows us to make an apples-to-apple comparison of individual scores across different domains, even if some domains are more challenging than others. We then converted these z-scores into a 1-100 scale for easy interpretation.

We restricted the data to the 50 countries with the most developers on HackerRank.

Here’s what we found:



Since China scored the highest, Chinese developers sit at the top of the list with a score of 100. But China only won by a hair. Russia scored 99.9 out of 100, while Poland and Switzerland round out the top rankings with scores near 98. Pakistan scores only 57.4 out of 100 on the index.

The two countries that contribute the greatest number of developers, India and the United States don’t place in the top half. India ranks 31st, with an overall score of 76 and the United States falls in at 28th, with a score of 78.

Though China outperformed everyone else on average, they didn’t dominate across the board. Which country produces the best developers in particular skill areas? Let’s take a look at the top countries in each domain.

China did quite well in a number of domains. Chinese developers beat out the competition in data structures, mathematics, and functional programming. On the other hand, Russia dominates in algorithms, the domain with the most popular challenges. Coming next, Poland and China nearly tie for second and third place, respectively.

What explains the different performance levels of different countries across domains? One possible explanation is that Russians are just more likely to participate in algorithms and therefore get more practice in that domain, while Chinese developers are disproportionately drawn to data structures.

Software engineer Shimi Zhang is one such programmer who ranked among the top 10 programmers in our Functional Programming domain. He hails from China’s city of Chongqing, and moved to the US just two years ago to get his master’s in computer science before coming to work at HackerRank.

On the greatness of Chinese developers, from top-ranked Shimi Zhang:

In universities and colleges, education resources are relatively fewer in comparison with many other countries, so students have less choices in their paths to programming. Many great students end up obsessed with competitive programming since it’s one of the few paths. China even has a big population of students who started programming in middle school and high school. They’re trying to solve some hard challenges only few people in this world can solve. They even host national programming contests for young programmers, like NOIp (national olympiad in informatics in provinces) and NOI (national olympiad in informatics). And after CTSC (China Team Selection Contest), 4 geniuses go to IOI (international olympiad in informatics), and at least 3 have won a gold medal this year. This has been the trend for nearly 10 years. It’s an even greater achievement considering a special rule: if you had won a gold medal once, you won’t be selected for future IOI team, that means, most IOI team member from China won gold medal with their first try.

Next up, we also compared how the developers in each country split their time up amongst different challenge types and then compared these domain preferences to those of the average HackerRank user. This allowed us to figure out which countries are more likely than the rest to take a test in a particular domain—and which countries are less likely than the rest.



As the table above shows, China participated in mathematics competitions at a much higher rate than would be expected given the average developer’s preferences. This might help explain how they were able to secure the top rank in that domain. Likewise, Czech developers showed an outsized preference for shell competitions, a domain in which they ranked number one.

But beyond these two examples, there seems to be little relationship between a country’s preference for a particular challenge type and its performance in that domain. We also wanted to know whether countries have specific preferences when it comes to programming languages. Are Indians more interested in C++? Do Mexicans code in Ruby?

The following chart breaks down the proportion of tests taken in each language by country.



In general, developers of different nationalities participate in Java challenges more than tests in any other programming language (with a few notable exceptions like Malaysia and Pakistan, where users prefer C++, and Taiwan, where Python is king). Sri Lanka comes in at number one in its preference for Java. India, which supplies a big portion of HackerRank developers, ranks 8th.

***

While Pakistan, Sri Lanka and Nigeria are currently toward the bottom of the hacker rankings, they can look to Switzerland’s steadfast developers for inspiration. When a HackerRank developer gives up on a challenge before making any progress, they earn a score of zero. Switzerland has the lowest percentage of nil scoring users, which make Swiss coders the Most Tenacious Programmers in the World.

***

Every day, developers around the world compete with each other to become the next Gates or Knuth.

If we held a hacking Olympics today, our data suggests that China would win the gold, Russia would take home a silver, and Poland would nab the bronze. Though they certainly deserve credit for making a showing, the United States and India have some work ahead of them before they make it into the top 25.











