HackerRank Class in C++ problem solution - TheCScience