๐Ÿ’•[ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค] ๋ฐฐ์—ด ๋‘ ๋ฐฐ ๋งŒ๋“ค๊ธฐ

Chobbyยท2022๋…„ 10์›” 8์ผ
1

Programmers

๋ชฉ๋ก ๋ณด๊ธฐ
69/349

๐Ÿงก๋ฌธ์ œ ์„ค๋ช…

์ •์ˆ˜ ๋ฐฐ์—ด numbers๊ฐ€ ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ ์ฃผ์–ด์ง‘๋‹ˆ๋‹ค. numbers์˜ ๊ฐ ์›์†Œ์— ๋‘๋ฐฐํ•œ ์›์†Œ๋ฅผ ๊ฐ€์ง„ ๋ฐฐ์—ด์„ returnํ•˜๋„๋ก solution ํ•จ์ˆ˜๋ฅผ ์™„์„ฑํ•ด์ฃผ์„ธ์š”.


๐Ÿ’›์ œํ•œ์‚ฌํ•ญ

  • -10,000 โ‰ค numbers์˜ ์›์†Œ โ‰ค 10,000
  • 1 โ‰ค numbers์˜ ๊ธธ์ด โ‰ค 1,000

๐Ÿ’š์ž…์ถœ๋ ฅ ์˜ˆ

numbersresult
[1, 2, 3, 4, 5][2, 4, 6, 8, 10]
[1, 2, 100, -99, 1, 2, 3][2, 4, 200, -198, 2, 4, 6]

๐Ÿ’™์ž…์ถœ๋ ฅ ์˜ˆ ์„ค๋ช…

์ž…์ถœ๋ ฅ ์˜ˆ #1

[1, 2, 3, 4, 5]์˜ ๊ฐ ์›์†Œ์— ๋‘๋ฐฐ๋ฅผ ํ•œ ๋ฐฐ์—ด [2, 4, 6, 8, 10]์„ returnํ•ฉ๋‹ˆ๋‹ค.
์ž…์ถœ๋ ฅ ์˜ˆ #2

[1, 2, 100, -99, 1, 2, 3]์˜ ๊ฐ ์›์†Œ์— ๋‘๋ฐฐ๋ฅผ ํ•œ ๋ฐฐ์—ด [2, 4, 200, -198, 2, 4, 6]์„ returnํ•ฉ๋‹ˆ๋‹ค.

๐Ÿ’œ๋‚˜์˜ ํ’€์ด

const solution = numbers => numbers.map(a => a*2)
profile
๋‚ด ์ง€์‹์„ ๊ณต์œ ํ•  ์ˆ˜ ์žˆ๋Š” ๋Œ€๋‹ดํ•จ

0๊ฐœ์˜ ๋Œ“๊ธ€