let fs = require('fs');
let path = process.platform === 'linux' ? '/dev/stdin' : './data.txt';
let input = fs.readFileSync(path).toString().trim().split(' ');
function solve(input) {
let arrayReverse = ([firstReverse, secondReverse] = input.map((value) =>
value
.split('')
.reverse()
.reduce((acc, cur) => acc + cur)
));
return Math.max(...arrayReverse.map((x) => Number(x)));
}
console.log(solve(input));
๋ฐฐ์ด ๊ตฌ์กฐ๋ถํดํ ๋น์ ์ด์ฉํด์ ํ๋ฒ์ ๊ฐ ์ซ์๋ฅผ ๋ฌธ์์ด ํํ๋ก ๋ค์ง์ด์ฃผ๊ณ ์ซ์ํ์ผ๋ก ๋ฐ๊ฟ์ค ๋ค ์ต๋๊ฐ์ ์ฐพ์๋ค.
์ฌ์ด ๋ฌธ์ ์ง๋ง, ๊ฐ์ธ์ ์ผ๋ก ๋ฐฐ์ด์ ๋ํ ์ดํด๋๊ฐ ์กฐ๊ธ์ ๋์์ก๋ค๊ณ ๋๋ผ๊ฒ ํด์ค ๋ฌธ์ :)
'๐ JavaScript > ๋ฐฑ์ค' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[JS] 2941 (0) | 2022.05.18 |
---|---|
[JS] 5622 (0) | 2022.05.18 |
[JS] 1152 (0) | 2022.05.17 |
[JS] 1157 (0) | 2022.05.17 |
[JS] 2675 (0) | 2022.05.17 |