Added solving problems with algorithm 2.