We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 25d9987 commit 4aeb04aCopy full SHA for 4aeb04a
502-ipo.js
@@ -6,9 +6,9 @@
6
* @return {number}
7
*/
8
const findMaximizedCapital = function(k, W, Profits, Capital) {
9
- let idxArr = Profits.map((_, i) => i).sort((ia, ib) => Profits[ib] - Profits[ia]);
+ const idxArr = Profits.map((_, i) => i).sort((ia, ib) => Profits[ib] - Profits[ia]);
10
while (k) {
11
- let choose = idxArr.findIndex(i => Capital[i] <= W);
+ const choose = idxArr.findIndex(i => Capital[i] <= W);
12
if (choose == -1) return W;
13
W += Profits[idxArr[choose]];
14
idxArr.splice(choose, 1);
0 commit comments