Repository navigation
Replies: 2 comments
|
應該可以用一個 |
0 replies
|
我的想法是先如何取出 第二層 根據第一層 如果相同就 最後在 參考:Math.max() - JavaScript | MDN [程式碼] function solve(lines) {
const numbers = lines[1].split(' ').map(item => Number(item));
const maxNumber = Math.max(...numbers);
const answer = [];
for (let i = 1; i <= maxNumber; i++) {
let sum = 0;
for (let j = 0; j < numbers.length; j++) {
if (i === numbers[j]) {
sum++;
}
}
answer.push(sum);
}
console.log(Math.max(...answer));
} |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
老師好,各位同學好
想請問LIOJ 1018 大平台的解法問題
解題邏輯如下:
實際上寫出來相當複雜
想請問這樣的解題邏輯
是否還有可以再更精簡、更直覺的方式
謝謝大家
All reactions