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 | 31 |
Tags
- js
- ๊ตฌ๋ฆํค ์ฑ๋ฆฐ์ง
- js ๋ฌธ์์ด ์์ถ
- suspense ๋ณ๋ชฉํ์
- ๋ฐฑ์ค 1339๋ฒ ์๋ฐ์คํฌ๋ฆฝํธ
- emotion RSC
- js ์ค์ฝํ
- ๋ฐฑ์ค 1339๋ฒ js
- next13 emotion
- ์ฌ์ฉ์ฑ ๊ฐ์
- TypeError: createContext only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more:
- app router emotion
- ๊ตฌ๋ฆํค ์ฑ๋ฆฐ์ง ํ๊ณ
- ๋ฐฑ์ค 1339๋ฒ nodejs
- ๊ตฌ๋ฆํค
- ์๋ฐ์คํฌ๋ฆฝํธ ๋ฌธ์์ด ์์ถ
- js ๊ฑฐ๋ฆฌ๋๊ธฐ ํ์ธํ๊ธฐ
- ๋ฐฑ์ค 2108 nodejs
- ํ๋ก๊ทธ๋๋จธ์ค ๋ฌธ์์ด ์์ถ
- ์๋ฐ์คํฌ๋ฆฝํธ ์ค์ฝํ
- ์ค์ฝํ
- emtion app router
- ํ๋ก๊ทธ๋๋จธ์ค ๊ฑฐ๋ฆฌ๋๊ธฐ ํ์ธํ๊ธฐ
- suspense ๋น๋๊ธฐ
- ๋ฐฑ์ค 2108 ์๋ฐ์คํฌ๋ฆฝํธ
- ์นด์นด์ค ์ฝํ
- suspense react-query
- ๋ฆฌ์กํธ์ฟผ๋ฆฌ suspense
- ์ต์ ๋์ฒด์ด๋
- suspense ๋์์๋ฆฌ
Archives
- Today
- Total
Lennon FE
[ํ๋ก๊ทธ๋๋จธ์ค Lv.2] n์ง์ ๊ฒ์(js) ๋ณธ๋ฌธ
728x90
๋ฐ์ํ
https://programmers.co.kr/learn/courses/30/lessons/17687?language=javascript
function solution(n, t, m, p){
let changeNumber = [];
let answer = '';
let idx = p-1;
for(let i=0; i<t*m; i++){
changeNumber.push(i.toString(n));
}
changeNumber = changeNumber.join("");
while(answer.length < t){
answer+=changeNumber[idx].toUpperCase();
idx+=m;
}
return answer;
}
changeNumber ๋ฐฐ์ด์ i๊ฐ์ ๋ํด ์ง์๋ณํ์ ํ ๊ฒ์ pushํ๋ค.
๊ทธ ํ join์ผ๋ก ๋ฌธ์์ด๋ก ๋ง๋ค์ด์ค๋ค.
ex) 2์ง์๋ผ๋ฉด? => 0,1,2,3,4 => ['0', '1', '10', '11', '100'] => '011011100'
// t*m์ ์ต์ํ ์ ์ ๋๋ ๋์์ผ ๋ฌธ์ ๊ฐ ์๊ฒ ๋ค๊ณ ์ ์ํ๋ค.
๊ทธ ํ ์์(p-1) ๋ฐ ์ฐธ๊ฐ์ ์(m)์ ๋งํด์ผํ๋ ์(t)๋ฅผ ๊ณ ๋ คํด while๋ฌธ์ผ๋ก answer์ ๋ต์ ์ถ๊ฐํด์ฃผ๊ณ ๋ฆฌํดํด์ฃผ๋ฉด ๋๋ค.
728x90
๋ฐ์ํ
'๐ฅ Algorithm > Programmers' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ํ๋ก๊ทธ๋๋จธ์ค Lv.2] ์ฃผ์ฐจ ์๊ธ ๊ณ์ฐ(js) (0) | 2022.01.22 |
---|---|
[ํ๋ก๊ทธ๋๋จธ์ค Lv.2] ์ ๊ณ ๊ฒฐ๊ณผ ๋ฐ๊ธฐ(js) (0) | 2022.01.22 |
[ํ๋ก๊ทธ๋๋จธ์ค Lv.2] ํํ (js) (0) | 2021.11.18 |
[ํ๋ก๊ทธ๋๋จธ์ค Lv.2] ์์ ์ฐพ๊ธฐ (js) (0) | 2021.11.12 |
[ํ๋ก๊ทธ๋๋จธ์ค Lv.2] ํ๋ฆฐํฐ (js) (0) | 2021.11.10 |
Comments