✅C++ | ✅Use set | ✅Easy to Understand
Code\n\nclass Solution \n{\npublic:\n    int maxCount(vector<int>& banned, int n, int maxSum) \n    {\n        unordered_set<int> ban(banned.begin(), banned.end
# Code\n```\nclass Solution \n{\npublic:\n    int maxCount(vector<int>& banned, int n, int maxSum) \n    {\n        unordered_set<int> ban(banned.begin(), banned.end());\n        int cnt=0, sum = 0;\n        for(int i=1; i<=n; i++)\n        {\n            if(ban.count(i)==0 and sum+i <= maxSum)\n            {\n                cnt++;\n                sum += i;\n            }\n        }\n        return cnt;\n        \n    }\n};\n```
['Array', 'Counting', 'Ordered Set', 'C++']