Skip to content

Commit

Permalink
feat(lc): 每日一题
Browse files Browse the repository at this point in the history
  • Loading branch information
changshou83 committed Nov 23, 2022
1 parent cc7b7d6 commit 17c9e49
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
function countBalls(l, h) {
let res = 0;
const list = new Array(50).fill(0);
for (let i = l; i <= h; i++) {
let j = i,
cur = 0;
while (j != 0) {
cur += j % 10;
j = Math.floor(j / 10);
}

list[cur]++;
res = Math.max(list[cur], res);
}
return res;
}

0 comments on commit 17c9e49

Please sign in to comment.