其他分享
首页 > 其他分享> > 328 add two number

328 add two number

作者:互联网

 

 

 

 

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,number,next,add,328,null,odd
来源: https://www.cnblogs.com/LLflag1/p/16468575.html