Blog Archive

Saturday, September 13, 2014

[leetcode]Remove Nth Node From End of List @ Python - 南郭子綦 - 博客园

[leetcode]Remove Nth Node From End of List @ Python - 南郭子綦 - 博客园: " dummy=ListNode(0); dummy.next=head
p1=p2=dummy
for i in range(n): p1=p1.next
while p1.next:
p1=p1.next; p2=p2.next
p2.next=p2.next.next
return dummy.next"



'via Blog this'

No comments:

Post a Comment