是一个联系链表的好题目
本地操作,时常迷糊
class Solution:
def oddEvenList(self, head: ListNode) -> ListNode:
if(head is None or head.next is None):
return head
o = head
p = head.next
e = p
while(o.next is not None and e.next is not None):
o.next = e.next
o = o.next
e.next = o.next
e = e.next
o.next = p
return head