package leetcode;

/**
 * https://leetcode.com/problems/middle-of-the-linked-list/
 */
public class Problem876 {
    public static class ListNode {
        int val;
        ListNode next;

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

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

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

@@ -306,131 +306,316 @@
     
-// TODO%0A        return null;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Problem876 prob = new Problem876()
+int size = 0;%0A        for (ListNode n = head; n != null; n = n.next) %7B%0A            size++;%0A        %7D%0A        int index = size / 2;%0A        int i = 0;%0A        for (ListNode n = head; n != null; n = n.next) %7B%0A            if (i++ == index) %7B%0A                return n;%0A            %7D%0A        %7D%0A        return head
 ;%0A  

Solve problem 876