考察对链表的操作
class Solution(object):
def reorderList(self, head):
"""
:type head: ListNode
:rtype: void Do not return anything, modify head in-place instead.
"""
if not head or not head.next:
return
count=0
p=head
res=[]
while p:
res.append(p)
count+=1
p=p.next
count=count>>1
p=head
while count>0:
tail=res.pop()
r=p.next
p.next=tail
tail.next=r
p=r
count-=1
p.next=None