XYZ interview question

Question on doubly linked list and pattern