✅C++ ✅Easy Set Logic
\n\n# Code\n\nclass Solution {\npublic:\n    int maxCount(vector<int>& banned, int n, int maxSum) {\n        int maxi = 0;\n        int sum = 0;\n        \n    
\n\n# Code\n```\nclass Solution {\npublic:\n    int maxCount(vector<int>& banned, int n, int maxSum) {\n        int maxi = 0;\n        int sum = 0;\n        \n        // store banned indexes\n        set<int> st;\n        for( auto &it : banned ) st.insert( it );\n        \n        for( int i=1 ; i<=n ; i++ ){\n            \n            // indexes wihch are not in banned array \n            // take them, keeping the sum lesser than the maximum Sum \n            \n            if( st.count(i) == 0 && ((sum+i) <= maxSum )) {\n                sum += i;\n                maxi++;\n            }\n        }\n        \n        return maxi;\n    }\n};\n```\n# Please Upvote If U like the Solution :D
['C++']