Pergunta de entrevista da empresa Apple

One leetcode question on linked list.