C++ Solution || Detailed Explanation
Intuition\nThe problem requires us to select the maximum number of integers from 1 to n such that:\n- The selected integers are not present in the banned list.\
# Intuition\nThe problem requires us to select the maximum number of integers from `1` to `n` such that:\n- The selected integers are not present in the `banned` list.\n- The sum of selected integers does not exceed `maxSum`.\n\nThe goal is to maximize the count of selected integers while adhering to the constraints. To achieve this, we can iteratively pick integers starting from `1` and keep a running sum. We ensure that:\n1. The integer is not in the `banned` list.\n2. Adding the integer to the sum does not exceed `maxSum`.\n\n# Approach\n1. **Hash Set for Banned Numbers**:\n   - Convert the `banned` list into a hash set (`unordered_set`) for O(1) lookup time.\n2. **Iterate from 1 to `n`**:\n   - For each number, check if it is in the `banned` set.\n   - If not banned, check if adding the number to the current sum keeps the total \u2264 `maxSum`.\n   - If both conditions are satisfied, add the number to the sum and increment the count.\n   - Stop the loop if adding the current number exceeds `maxSum`.\n3. **Return the Count**:\n   - The count of valid numbers selected is returned as the result.\n\n# Complexity\n- **Time Complexity**:  $$O(n+b)$$  \n  - Building the hash set from the `banned` list takes O(b), where `b` is the size of the `banned` list.\n  - Iterating through numbers from `1` to `n` takes O(n).\n  - Each lookup in the hash set is O(1), so the overall complexity is O(n + b).\n  \n- **Space Complexity**:  $$O(b)$$  \n  - The space required for the hash set to store `banned` numbers is O(b).\n\n## Code\n```cpp\nclass Solution {\npublic:\n    int maxCount(vector<int>& banned, int n, int maxSum) {\n        unordered_set<int> st(banned.begin(), banned.end());\n\n        int sum = 0;    \n        int ansCnt = 0; \n\n        for (int i = 1; i <= n; i++) {\n            if (st.find(i) == st.end()) {\n                if (sum + i <= maxSum) {\n                    sum += i; \n                    ansCnt++;\n                } else {\n                    break; \n                }\n            }\n        }\n        return ansCnt; \n    }\n};\n```\n\n# Quote of the Day\n> ***Focus on what you can control and let go of the rest\u2014success often lies in careful choices and consistent effort." \uD83C\uDF1F***\n\n\n\n![1721315779911.jpeg](https://assets.leetcode.com/users/images/5954bfe7-316b-4534-aa7a-2768b2a44cc0_1733465715.6604636.jpeg)\n
['Array', 'Hash Table', 'C++']