I was able to get the code accepted, but there's one thing I'm confused about - in Python, what exactly is the data type for the "next" field, is it a pointer / reference, or is it a copy?
Specifically, with the given class definition
# class ListNode: # def __init__(self, x): # self.val = x # self.next = None
If I were to start from scratch and connect two existing nodes (n1=ListNode(0), n2=ListNode(0)), would the code be: n1.next = n2 ? Or something like n1.next = &n2 ? Is it necessary at all to be explicit about a copy of variable or a reference to a variable?