Simple iterate
\n\n# Code\njavascript []\n/**\n * @param {number[]} banned\n * @param {number} n\n * @param {number} maxSum\n * @return {number}\n */\nvar maxCount = function(
\n\n# Code\n```javascript []\n/**\n * @param {number[]} banned\n * @param {number} n\n * @param {number} maxSum\n * @return {number}\n */\nvar maxCount = function(banned, n, maxSum) {\n    const bannedSet = new Set(banned);\n    let cnt = 0;\n    let sum = 0;\n    for(let i = 1; i <= n; i++) {\n        if (!bannedSet.has(i)) {\n            if (i + sum <= maxSum) {\n                sum += i;\n                cnt++;\n            } else {\n                break;\n            }\n        }\n    }\n\n    return cnt;\n};\n```
['Array', 'Hash Table', 'Greedy', 'JavaScript']