Amazon Interview Question

Leetcode question was tricky related to linked list