Java | HashSet | 10 lines | Clean code
Complexity\n- Time complexity: O(n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(n)\n Add your space complexity here, e.g. O(n) \n\n# Co
# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n  public String destCity(List<List<String>> paths) {\n    var sources = new HashSet<String>();\n    var destination = new HashSet<String>();\n\n    for (var path : paths) {\n      sources.add(path.get(0));\n\n      if (destination.contains(path.get(0)))\n        destination.remove(path.get(0));\n\n      if (!sources.contains(path.get(1)))\n        destination.add(path.get(1));\n    }\n    return destination.iterator().next();\n  }\n}\n```\nIf you like my solution, please upvote it!
['Hash Table', 'String', 'Java']