✅🔥JAVA | Most Easy Solution
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:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\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        Set<Integer>set=new HashSet<>();\n        for(int i=0;i<banned.length;i++){\n            set.add(banned[i]);\n        }\n        int j=0;\n        int count=0;\n        int sum=0;\n        \n        for(int i=1;i<=n;i++){\n            if(!set.contains(i)){\n                count++;\n                sum+=i;\n                //if(sum==maxSum) return count; \n                if(sum>maxSum)  return count-1;\n            }\n        }\n        return count;\n    }\n}\n```
['Java']