HackerRank Pointer in C++ problem solution - TheCScience