๋ฐ˜์‘ํ˜•

์ฝ”๋”ฉ์—ฐ์Šต 2

[ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค/JS] ๋ฌธ์ž์—ด ์ •๋ ฌํ•˜๊ธฐ (1)

Problem Description ๋ฌธ์ž์—ด my_string์ด ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ ์ฃผ์–ด์งˆ ๋•Œ, my_string ์•ˆ์— ์žˆ๋Š” ์ˆซ์ž๋งŒ ๊ณจ๋ผ ์˜ค๋ฆ„์ฐจ์ˆœ ์ •๋ ฌํ•œ ๋ฆฌ์ŠคํŠธ๋ฅผ return ํ•˜๋„๋ก solution ํ•จ์ˆ˜๋ฅผ ์ž‘์„ฑํ•ด๋ณด์„ธ์š”. Restrictions. 1 ≤ my_string์˜ ๊ธธ์ด ≤ 100 my_string์—๋Š” ์ˆซ์ž๊ฐ€ ํ•œ ๊ฐœ ์ด์ƒ ํฌํ•จ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. my_string์€ ์˜์–ด ์†Œ๋ฌธ์ž ๋˜๋Š” 0๋ถ€ํ„ฐ 9๊นŒ์ง€์˜ ์ˆซ์ž๋กœ ์ด๋ฃจ์–ด์ ธ ์žˆ์Šต๋‹ˆ๋‹ค. - - - Input/Output Example ์ž…์ถœ๋ ฅ ์˜ˆ #1 "hi12392"์— ์žˆ๋Š” ์ˆซ์ž 1, 2, 3, 9, 2๋ฅผ ์˜ค๋ฆ„์ฐจ์ˆœ ์ •๋ ฌํ•œ [1, 2, 2, 3, 9]๋ฅผ return ํ•ฉ๋‹ˆ๋‹ค. ์ž…์ถœ๋ ฅ ์˜ˆ #2 "p2o4i8gj2"์— ์žˆ๋Š” ์ˆซ์ž 2, 4, 8, 2๋ฅผ ์˜ค๋ฆ„์ฐจ์ˆœ ์ •๋ ฌํ•œ [2, 2, 4,..

[ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค/JS] ์ตœ๋Œ“๊ฐ’ ๋งŒ๋“ค๊ธฐ (2)

Problem Description ์ •์ˆ˜ ๋ฐฐ์—ด numbers๊ฐ€ ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ ์ฃผ์–ด์ง‘๋‹ˆ๋‹ค. numbers์˜ ์›์†Œ ์ค‘ ๋‘ ๊ฐœ๋ฅผ ๊ณฑํ•ด ๋งŒ๋“ค ์ˆ˜ ์žˆ๋Š” ์ตœ๋Œ“๊ฐ’์„ returnํ•˜๋„๋ก solution ํ•จ์ˆ˜๋ฅผ ์™„์„ฑํ•ด์ฃผ์„ธ์š”. Restrictions. -10,000 ≤ numbers์˜ ์›์†Œ ≤ 10,000 2 ≤ numbers ์˜ ๊ธธ์ด ≤ 100. Input/Output Example ์ž…์ถœ๋ ฅ ์˜ˆ #1 ๋‘ ์ˆ˜์˜ ๊ณฑ์ค‘ ์ตœ๋Œ“๊ฐ’์€ -3 * -5 = 15 ์ž…๋‹ˆ๋‹ค. ์ž…์ถœ๋ ฅ ์˜ˆ #2 ๋‘ ์ˆ˜์˜ ๊ณฑ์ค‘ ์ตœ๋Œ“๊ฐ’์€ 10 * 24 = 240 ์ž…๋‹ˆ๋‹ค. My solution function solution(numbers) { numbers.sort((a, b) => a - b); const length = numbers.length; const posi..

๋ฐ˜์‘ํ˜•