package leetcode;

/**
 * https://leetcode.com/problems/linked-list-components/
 */
public class Problem817 {
    public static class ListNode {
        int val;
        ListNode next;

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

    public int numComponents(ListNode head, int[] G) {
        // TODO
        return 0;
    }

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

@@ -310,128 +310,867 @@
     
-// TODO%0A        return 0;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Problem817 prob = new Problem817()
+boolean%5B%5D nodes = new boolean%5B10000%5D;%0A        for (int g : G) %7B%0A            nodes%5Bg%5D = true;%0A        %7D%0A        int result = 0;%0A        boolean found = false;%0A        for (ListNode node = head; node != null; node = node.next) %7B%0A            if (nodes%5Bnode.val%5D) %7B%0A                if (!found) %7B%0A                    result++;%0A                %7D%0A                found = true;%0A            %7D else %7B%0A                found = false;%0A            %7D%0A        %7D%0A        return result;%0A    %7D%0A%0A    private static ListNode build(int%5B%5D nodes) %7B%0A        ListNode head = null;%0A        ListNode node = null;%0A        for (int i : nodes) %7B%0A            if (head == null) %7B%0A                head = new ListNode(i);%0A                node = head;%0A            %7D else %7B%0A                node.next = new ListNode(i);%0A                node = node.next;%0A            %7D%0A        %7D%0A        return head
 ;%0A  

Solve problem 817