JAVA || 2 LINE CODE || HASHMAP
PLEASE UPVOTE, IF YOU LIKE IT\n# Code\n\nclass Solution {\n    public int singleNonDuplicate(int[] arr) {\n        HashMap<Integer, Integer> map = new HashMap<>
**PLEASE** **UPVOTE**, **IF YOU LIKE IT**\n# Code\n```\nclass Solution {\n    public int singleNonDuplicate(int[] arr) {\n        HashMap<Integer, Integer> map = new HashMap<>();\n        for (int i : arr) map.put(i, map.getOrDefault(i, 0) + 1);\n        for (int i : arr) if (map.get(i) == 1) return i;\n        return 0;\n    }\n}\n```
['Hash Table', 'Hash Function', 'Java']