[JavaScript] With out heap
\nvar findMaximizedCapital = function(k, w, profits, capital) {\n   if(w >= Math.max(...capital)) {\n      profits.sort((a, b) => b - a);\n      return profits.
```\nvar findMaximizedCapital = function(k, w, profits, capital) {\n   if(w >= Math.max(...capital)) {\n      profits.sort((a, b) => b - a);\n      return profits.slice(0, k).reduce((acc, num) => acc + num, w);\n   }\n    \n    for (let i = 0; i < k; i++) {\n       let maxProfit = -Infinity;\n       let projectIndex = -1;\n       for (let j = 0; j < profits.length; j++) {\n          if (w < capital[j]) continue;\n          \n          if (profits[j] >= maxProfit) {\n            projectIndex = j;\n            maxProfit = profits[j];\n          }\n       }\n       if (projectIndex === -1) {\n         break;\n       }\n       capital[projectIndex] = Infinity;\n       w += maxProfit;        \n    }\n    return w;\n};\n\n```
['JavaScript']