@@ -0,0 +1,655 @@
+package leetcode;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0A/**%0A * https://leetcode.com/problems/find-center-of-star-graph/%0A */%0Apublic class Problem1791 %7B%0A    public int findCenter(int%5B%5D%5B%5D edges) %7B%0A        Map%3CInteger, Integer%3E map = new HashMap%3C%3E();%0A        for (int%5B%5D edge : edges) %7B%0A            if (map.containsKey(edge%5B0%5D)) %7B%0A                return edge%5B0%5D;%0A            %7D else %7B%0A                map.put(edge%5B0%5D, 1);%0A            %7D%0A            if (map.containsKey(edge%5B1%5D)) %7B%0A                return edge%5B1%5D;%0A            %7D else %7B%0A                map.put(edge%5B1%5D, 1);%0A            %7D%0A        %7D%0A        // Can never happen.%0A        return 0;%0A    %7D%0A%7D%0A

Solve problem 1791