Added C++ solution attempt