-1
我解决了这个问题,但在此之前,我正在尝试其他方法无效。Python链表黑客排名
def insert(self,head,data):
if (head == None):
head = Node(data)
else:
current = head
while current != None:
current = current.next
current = Node(data)
return head
这是我做的第一个,然后我做了这个
def insert(self,head,data):
if (head == None):
head = Node(data)
else:
current = head
while True:
if(current.next == None):
current.next = Node(data)
break
current = current.next
return head
这里是链接的问题https://www.hackerrank.com/challenges/30-linked-list
你的问题是什么? – MooingRawr