Easy to understand Set solution
Intuition\n1. The intuition is simple , keep all the banned elements into a set since its easy to search if a element exists or not.\n2. Since, the elements val
# Intuition\n1. The intuition is simple , keep all the banned elements into a set since its easy to search if a element exists or not.\n2. Since, the elements values are between [1,n], we iterate between two limits and keep on checking if this element is seen in the set. \n3. If seen, we ignore that otherwise we keep on adding it to sum and keep an count of number of elements.\n4. And once, the sum exceeds maxSum we return the count.\n\n# Complexity\n- Time complexity:\nO(m+n) where m is the size of the banned array.\n\n- Space complexity:\nO(m) where m is the size of the banned array.\n\n# Code\n```java []\nclass Solution {\n    public int maxCount(int[] banned, int n, int maxSum) {\n        int m = banned.length;\n        int sum =0, cnt=0;\n        Set<Integer> set = new HashSet<>();\n        for(int i=0;i<m;i++) {\n            set.add(banned[i]);\n        }\n\n        for(int i=1;i<=n;i++) {\n            if(!set.contains(i)) {\n                sum +=i;   \n                if(sum > maxSum) {\n                    break;\n                }\n                cnt++;\n            }\n        }\n        return cnt;\n    }\n}\n```
['Hash Table', 'Java']