Qualcomm Interview Question

Linked list problem