EASY C++ || unordered_map Solution :)
\n\n# Approach\nKeep iterating from 1 to n and check whether the number is present in the hashmap or not , if not then add the number to the sum and keep increa
\n\n# Approach\nKeep iterating from 1 to n and check whether the number is present in the hashmap or not , if not then add the number to the sum and keep increasing the count , once the sum exceeds the maxSum we can break out of the loop as there\'s no point in iterating further more.\n\nUPVOTE PLZ IF you like my approach. Thanks\n\n# Complexity\n- Time complexity:\n    O(n)\n\n- Space complexity:\n    O(n)\n\n# Code\n```\nclass Solution {\npublic:\n    int maxCount(vector<int>& banned, int n, int maxSum) {\n        \n    unordered_map<int,int> mp; int sum = 0;\n    int ans = 0;\n\n    for(int i = 0; i<banned.size(); i++)\n    {\n        mp[banned[i]]++;\n    }\n\n    for(int i = 1 ; i<=n ; i++)\n    {\n        if(mp.find(i) == mp.end())\n        {\n            sum += i;\n            if(sum <= maxSum)\n                ans += 1;\n            else\n                break;\n               \n        }\n    }\n\n    return ans;\n        \n    }\n};\n```
['C++']