Java solution || easy to understand
Please UPVOTE if you do like my solution!\n\nclass Solution {\n    public int maxCount(int[] banned, int n, int maxSum) {\n        Set<Integer> set = new HashSe
Please **UPVOTE** if you do like my solution!\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 sum = 0;\n        int count = 0;\n        for(int i = 1;i<=n;i++){\n            if(!set.contains(i)){\n                sum += i;\n                if(sum>maxSum){\n                    break;\n                }\n                else{\n                    count++;\n                } \n            }\n            \n        }\n        return count;\n    }\n}\n```
['Java']