C++ codes for interview problems