C++ Easy Solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n1.Create unordered set and store the values of banned as unordered set gi
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n1.Create unordered set and store the values of banned as unordered set gives O(1) complexity while searching.\n2.Loop through 1 from range of N.\n3.Count the integer if it is not in banned sum it up.\n4.Exit the loop if maxSum exceeds.\n\n# Complexity\n- Time complexity:\n O(m+n)\n\n- Space complexity:\n  O(n)\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int maxCount(vector<int>& banned, int n, int maxSum) {\n        unordered_set<int> ans(banned.begin(),banned.end());//to check in O(1) complexity if range of number is in banned or not\n        int count=0;  //For counting integers\n        int sum=0;  //to check the sum exceed or not\n        int i=1; //For the Range of number\n        while(i<=n&&sum+i<=maxSum){\n            if(ans.find(i)==ans.end()){\n                cout<<i<<endl;\n                count++;\n                sum+=i;\n            }\n            i++;\n        }\n        return count;\n    }\n};\n```
['C++']