C++ solution of book Cracking the Code Interview