A fast C++ solution and a brute force C solution for problem 15