๐Ÿ‘ฝ[ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค] ์™ธ๊ณ„ํ–‰์„ฑ์˜ ๋‚˜์ด

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

Programmers

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

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

์šฐ์ฃผ์—ฌํ–‰์„ ํ•˜๋˜ ๋จธ์“ฑ์ด๋Š” ์—”์ง„ ๊ณ ์žฅ์œผ๋กœ PROGRAMMERS-962 ํ–‰์„ฑ์— ๋ถˆ์‹œ์ฐฉํ•˜๊ฒŒ ๋์Šต๋‹ˆ๋‹ค. ์ž…๊ตญ์‹ฌ์‚ฌ์—์„œ ๋‚˜์ด๋ฅผ ๋งํ•ด์•ผ ํ•˜๋Š”๋ฐ, PROGRAMMERS-962 ํ–‰์„ฑ์—์„œ๋Š” ๋‚˜์ด๋ฅผ ์•ŒํŒŒ๋ฒณ์œผ๋กœ ๋งํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. a๋Š” 0, b๋Š” 1, c๋Š” 2, ..., j๋Š” 9์ž…๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด 23์‚ด์€ cd, 51์‚ด์€ fb๋กœ ํ‘œํ˜„ํ•ฉ๋‹ˆ๋‹ค. ๋‚˜์ด age๊ฐ€ ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ ์ฃผ์–ด์งˆ ๋•Œ PROGRAMMER-962์‹ ๋‚˜์ด๋ฅผ returnํ•˜๋„๋ก solution ํ•จ์ˆ˜๋ฅผ ์™„์„ฑํ•ด์ฃผ์„ธ์š”.


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

  • age๋Š” ์ž์—ฐ์ˆ˜์ž…๋‹ˆ๋‹ค.
  • age โ‰ค 1,000
  • PROGRAMMERS-962 ํ–‰์„ฑ์€ ์•ŒํŒŒ๋ฒณ ์†Œ๋ฌธ์ž๋งŒ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

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

ageresult
23"cd"
51"fb"
100"baa"

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

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

  • age๊ฐ€ 23์ด๋ฏ€๋กœ "cd"๋ฅผ returnํ•ฉ๋‹ˆ๋‹ค.

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

  • age๊ฐ€ 51์ด๋ฏ€๋กœ "fb"๋ฅผ returnํ•ฉ๋‹ˆ๋‹ค.

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

  • age๊ฐ€ 100์ด๋ฏ€๋กœ "baa"๋ฅผ returnํ•ฉ๋‹ˆ๋‹ค.

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

function solution(age) {
    const alpha = ['a','b','c','d','e','f','g','h','i','j']
    return String(age).split("").map(a => alpha[+a]).join("")
}
profile
๋‚ด ์ง€์‹์„ ๊ณต์œ ํ•  ์ˆ˜ ์žˆ๋Š” ๋Œ€๋‹ดํ•จ

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