solution for linked list part