Add algorithm of this solution.