solced algorithm 2