其他分享
首页 > 其他分享> > 325 add two nunber

325 add two nunber

作者:互联网


class Solution {

    public ListNode oddEvenList(ListNode head) {

        if(head==null) return null;

        ListNode odd=head,even=head.next,evenHead=even;

        while(even!=null&&even.next!=null){

            odd.next=even.next;

            odd=odd.next;

            even.next=odd.next;

            even=even.next;

        }

        odd.next=evenHead;

        return head;

        

    }

}

 

标签:even,head,ListNode,nunber,two,next,add,null,odd
来源: https://www.cnblogs.com/LLflag1/p/16468576.html