Linked-list possible solution