✅ JAVA || HashSet || single Loop || Easy💯🔥
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# 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 int maxCount(int[] banned, int n, int maxSum) {\n        HashSet<Integer> set = new HashSet<>();\n        for(int ele : banned){\n            set.add(ele);\n        }\n        \n        int count = 0;\n        for (int i = 1; i <= n; i++) {\n            if (set.contains(i))\n                continue;\n            if (i <= maxSum) {\n                count++;\n                maxSum -= i;\n            } else {\n                break;\n            }\n        }\n        return count;\n    }\n}\n```\n\n![image](https://assets.leetcode.com/users/images/beec0cb1-8645-4e53-96d7-4ae7787555a5_1675528914.8029478.jpeg)\n
['Array', 'Hash Table', 'Java']