package leetcode;

/**
 * https://leetcode.com/problems/partition-list/
 */
public class Problem86 {
    public class ListNode {
        int val;
        ListNode next;
        ListNode(int x) {
            val = x;
        }
    }

    public ListNode partition(ListNode head, int x) {
        // TODO
        return null;
    }

    public static void main(String[] args) {

    }
}

@@ -101,24 +101,31 @@
 %0A    public 
+static 
 class ListNo
@@ -129,16 +129,16 @@
 tNode %7B%0A
-
         
@@ -299,89 +299,900 @@
     
-// TODO%0A        return null;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A
+ListNode left = null;%0A        ListNode right = null;%0A        ListNode headLeft = null;%0A        ListNode headRight = null;%0A        for (ListNode n = head; n != null; n = n.next) %7B%0A            if (n.val %3C x) %7B%0A                if (left == null) %7B%0A                    left = new ListNode(n.val);%0A                    headLeft = left;%0A                %7D else %7B%0A                    left.next = new ListNode(n.val);%0A                    left = left.next;%0A                %7D%0A            %7D else %7B%0A                if (right == null) %7B%0A                    right = new ListNode(n.val);%0A                    headRight = right;%0A                %7D else %7B%0A                    right.next = new ListNode(n.val);%0A                    right = right.next;%0A                %7D%0A            %7D%0A        %7D%0A        if (left != null) %7B%0A            left.next = headRight;%0A            return headLeft;%0A        %7D%0A        return head;
 %0A   

Solve problem 86