package leetcode;

/**
 * https://leetcode.com/problems/odd-even-linked-list/
 */
public class Problem328 {
    public class ListNode {
        int val;
        ListNode next;

        ListNode(int x) {
            val = x;
        }
    }

    public ListNode oddEvenList(ListNode head) {
        // TODO
        return null;
    }

    public static void main(String[] args) {
        Problem328 prob = new Problem328();
    }
}

@@ -108,24 +108,31 @@
 %0A    public 
+static 
 class ListNo
@@ -136,16 +136,16 @@
 tNode %7B%0A
-
         
@@ -302,24 +302,39 @@
     
-// TODO%0A
+if (head == null) %7B%0A   
         
 retu
@@ -333,14 +333,54 @@
     
+ 
 return
+ head;%0A        %7D%0A        ListNode odd =
  nul
@@ -390,98 +390,789 @@
     
-%7D%0A%0A
     
-public static void main(String%5B%5D args) %7B%0A        Problem328 prob = new Problem328()
+ListNode even = null;%0A        ListNode evenHead = null;%0A        int i = 1;%0A        ListNode next = null;%0A        for (ListNode node = head; node != null; node = next) %7B%0A            next = node.next;%0A            node.next = null;%0A            if (i %25 2 == 0) %7B%0A                if (even == null) %7B%0A                    evenHead = node;%0A                    even = node;%0A                %7D else %7B%0A                    even.next = node;%0A                    even = even.next;%0A                %7D%0A            %7D else %7B%0A                if (odd == null) %7B%0A                    odd = node;%0A                %7D else %7B%0A                    odd.next = node;%0A                    odd = odd.next;%0A                %7D%0A            %7D%0A            i++;%0A        %7D%0A        odd.next = evenHead;%0A        return head
 ;%0A  

Solve problem 328