package com.fishercoder.solutions;

import java.util.*;

public class _1557 {
    public static class Solution1 {
        public List<Integer> findSmallestSetOfVertices(int n, List<List<Integer>> edges) {
            List<Integer> starts = new ArrayList<>();
            Map<Integer, Set<Integer>> indegree = new HashMap<>();
            for (int i = 0; i < edges.size(); i++) {
                int end = edges.get(i).get(1);
                if (!indegree.containsKey(end)) {
                    indegree.put(end, new HashSet<>());
                }
                indegree.get(end).add(edges.get(i).get(0));
            }
            for (int i = 0; i < n; i++) {
                if (!indegree.containsKey(i)) {
                    starts.add(i);
                }
            }
            return starts;
        }
    }
}

@@ -50,9 +50,136 @@
 til.
-*
+ArrayList;%0Aimport java.util.HashMap;%0Aimport java.util.HashSet;%0Aimport java.util.List;%0Aimport java.util.Set;%0Aimport java.util.Map
 ;%0A%0Ap

fix build