Cavisson Systems interview question

Linked list swap elements from end and begin