The answer of Alogorithms_part1 assignment.