题目:反转一个链表
def reverseList(head): cur,pre = head,None while cur: cur.next,pre,cur = pre,cur,cur.next return prev
注:
python超简洁版的,值得学习参考
题目:反转一个链表
def reverseList(head): cur,pre = head,None while cur: cur.next,pre,cur = pre,cur,cur.next return prev
注:
python超简洁版的,值得学习参考