Notice
Recent Posts
Recent Comments
Link
์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- fe
- CSS
- react
- HTML
- node.js
- ํ์ด์ฌ
- Til
- ํ๋ก๊ทธ๋๋จธ์ค
- JS
- ํ๋ก ํธ์๋
- ์๊ณ ๋ฆฌ์ฆ
- ๊ตญ๋น์ง์
- ๋๋ฆผ์ฝ๋ฉ
- ํ ์ดํ๋ก์ ํธ
- mongodb
- Python
- KDT
- ์ฝ๋ฉ์ ํ
- ๊ฐ๋ฐ
- ๋ ธ๋ง๋์ฝ๋
- ๋ชจ๊ฐ์ฝ
- ๋ฐฑ์ค
- ํ๋ก์ ํธ
- ์ฝ๋ฉํ ์คํธ
- error
- ํฌ๋กค๋ง
- javascript
- heapq
- ์ฝ๋ฉ
- ๊ทธ๋ฆฌ๋
Archives
- Today
- Total
๐ฑ → ๐ณ
[ํ๋ก๊ทธ๋๋จธ์ค] ์๋ฐ์๋ฐ์๋ฐ์๋ฐ์๋ฐ์? JavaScript ๋ณธ๋ฌธ
Algorithms
[ํ๋ก๊ทธ๋๋จธ์ค] ์๋ฐ์๋ฐ์๋ฐ์๋ฐ์๋ฐ์? JavaScript
BAY 2022. 7. 22. 14:35728x90
https://school.programmers.co.kr/learn/courses/30/lessons/12922
์์ฑ ์ฝ๋:
function solution(n) {
var answer = '';
for(let i=1; i<n+1; i++){
if(i%2==1){
answer += "์";
} else{
answer += "๋ฐ";
}
}
return answer;
}
๋ค๋ฅธ ์ฌ๋์ ํ์ด:
const waterMelon = n => "์๋ฐ".repeat(n).slice(0,n);
"์๋ฐ"์ด๋ผ๋ ๋ฌธ์์ด์ n๋ฒ repeatํ๋ฉด ๋ฌธ์์ด์ ๊ธธ์ด 2n์ด ๋จ
๊ฑฐ๊ธฐ์ slice ํจ์๋ฅผ ์ด์ฉํ์ฌ n๊น์ง ์๋ฅด๊ธฐ
728x90
'Algorithms' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค] 9020๋ฒ: ๊ณจ๋๋ฐํ์ ์ถ์ธก (0) | 2022.07.30 |
---|---|
[๋ฐฑ์ค] 4948๋ฒ: ๋ฒ ๋ฅดํธ๋ ๊ณต์ค (0) | 2022.07.30 |
[๋ฐฑ์ค] 1929๋ฒ: ์์ ๊ตฌํ๊ธฐ python (0) | 2022.07.22 |
[๋ฐฑ์ค] 11653๋ฒ: ์์ธ์๋ถํด python (0) | 2022.07.20 |
[๋ฐฑ์ค] 2869๋ฒ: ๋ฌํฝ์ด๋ ์ฌ๋ผ๊ฐ๊ณ ์ถ๋ค python (0) | 2022.07.17 |