Used another algorithm to implement the task