Java || Easy To Understand || Intuitive Approach
\n\n# Code\n\nclass Solution {\n    public int maxCount(int[] banned, int n, int maxSum) {\n        HashSet<Integer> set = new HashSet<>();\n//         for each
\n\n# Code\n```\nclass Solution {\n    public int maxCount(int[] banned, int n, int maxSum) {\n        HashSet<Integer> set = new HashSet<>();\n//         for each loop to avoid error \n        for (int i : banned) {\n            set.add(i);\n             }\n        int answer = 0;\n        for (int i = 1; i <= n; i++) {\n            if (!set.contains(i) ){\n            if( i <= maxSum){\n                answer++;\n                maxSum = maxSum - i;\n            }\n        }\n    }\n        return answer;\n    }\n}\n```
['Hash Table', 'Java']