ctci 5th edition solution in C++