Bloomberg interview question

Linked list flattening