algorithm’s solution