hackerrank icon indicating copy to clipboard operation
hackerrank copied to clipboard

HackerRank personal solutions

HackerRank HackerRank

Build Status 819 solutions and counting

HackerRank is a great place to learn, improve, play with your programming skills.

All challenges are runnable, except SQL and multiple choice question ones. They are verified with their default testcase (usually Testcase 0).

Solutions

C++ Python Shell Java     Algorithms Data Structures Mathematics

30 Days of Code Cracking the Coding Interview 10 Days of Statistics 10 Days of Javascript     Regex Security Databases SQL

The curated challenges of Interview Preparation Kit.

And ProjectEuler+ (See here my solutions of Project Euler)

Usage and tools

Requirements

Compilation

mkdir build
cd build
cmake ..
make

Tests

cd build
make extract-testcases
ctest [-R filter]

It will download the challenge testcases and run solution programs.

A solution can be tested solely with runtest.sh -t challenge-name [-n test-number] in its build subdirectory.

Tools

  • hrinit.py creates a new file for a given challenge based on the HackerRank template. Default choice for language is Python 3.
  • runtest.sh is the script used by CTest to verify the solution.
  • compare.py aims to fairly compare the program output with the excepted one. It is necessary since some challenges use decimal numbers : we cannot simply use diff -qw.
  • hrtc2.py can be used to download «purchased» testcases or to create new ones. Copy and paste the download links of input and output data.

Other (hacking) tools

  • hr_github.sh creates the testcases archive and sync the private repo to the public GitHub one
  • hr_table.py automatically creates README.md files with challenge lists (requires offline data)
  • hr_count.py counts challenges and testcases - used to update toplevel README.md
  • hr_offline.py downloads challenge catalogs and more
  • hr_interview.py gets the playlist of Interview Preparation Kit
  • hr_menu.py displays a graphical menu to browse challenges and solve them when no Internet connection is available (requires offline data)
  • hr_db.py creates a SQLite database - used to understand how data is structured (or not!)

IDE

Visual Studio Code is a great free IDE that comes with many plugins. Some configuration files are provided and a Bash initialization file.

Other online resources

License

Unlicense aka. Public Domain 🤘