Amazon Interview Question

linked list problem leetcode medium