Linked List Problem In Leetcode Solutions Python