add a solution for linked list