Brought back C++ solutions to 1 and 2.