update C++ solution