linked list implementation
2-1 solution