function solution(common) {
return common[1] - common[0] === common[2] - common[1]
? common[0] + common.length * (common[1] - common[0])
: common[common.length - 1] * 2;
}
- ํ ๋๋ ๋๋ผ์ง ๋ชปํ๋๋ฐ.. ๊ฐ๋ ์ฑ์ด.. ๋ฐ์ฑ..
ํผ๋๋ฐฑ
function solution(common) {
const diff1 = common[1] - common[0];
const diff2 = common[2] - common[1];
return diff1 === diff2
? common[common.length - 1] + diff1
: common[common.length - 1] * 2;
}
- ๋ณ์๋ก ํ ๋นํด์ ๊ฐ๋ ์ฑ ์ฑ๊ธฐ๊ธฐ ๐
'์๊ณ ๋ฆฌ์ฆ & ๋ฌธ์ ํ์ด > Programmers-0' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
์ง๋ฃ์์ ์ ํ๊ธฐ (0) | 2022.10.19 |
---|---|
์์ธ์๋ถํด (0) | 2022.10.19 |
๊ตฌ์ฌ์ ๋๋๋ ๊ฒฝ์ฐ์ ์ (0) | 2022.10.19 |
์ปจํธ๋กค ์ ํธ (0) | 2022.10.19 |
๋ฌธ์์ด ๊ณ์ฐํ๊ธฐ (0) | 2022.10.19 |