Add flatten linked list algo