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
- ๋ฐฑ์ค 1339๋ฒ ์๋ฐ์คํฌ๋ฆฝํธ
- suspense ๋น๋๊ธฐ
- js ๋ฌธ์์ด ์์ถ
- js ๊ฑฐ๋ฆฌ๋๊ธฐ ํ์ธํ๊ธฐ
- next13 emotion
- ๋ฐฑ์ค 2108 nodejs
- suspense ๋์์๋ฆฌ
- app router emotion
- ๊ตฌ๋ฆํค
- ์นด์นด์ค ์ฝํ
- emotion RSC
- emtion app router
- ์ต์ ๋์ฒด์ด๋
- ๊ตฌ๋ฆํค ์ฑ๋ฆฐ์ง
- ๊ตฌ๋ฆํค ์ฑ๋ฆฐ์ง ํ๊ณ
- ๋ฐฑ์ค 1339๋ฒ js
- ํ๋ก๊ทธ๋๋จธ์ค ๊ฑฐ๋ฆฌ๋๊ธฐ ํ์ธํ๊ธฐ
- ๋ฐฑ์ค 2108 ์๋ฐ์คํฌ๋ฆฝํธ
- ๋ฆฌ์กํธ์ฟผ๋ฆฌ suspense
- suspense ๋ณ๋ชฉํ์
- suspense react-query
- js
- ์๋ฐ์คํฌ๋ฆฝํธ ๋ฌธ์์ด ์์ถ
- TypeError: createContext only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more:
- ๋ฐฑ์ค 1339๋ฒ nodejs
- ์๋ฐ์คํฌ๋ฆฝํธ ์ค์ฝํ
- js ์ค์ฝํ
- ํ๋ก๊ทธ๋๋จธ์ค ๋ฌธ์์ด ์์ถ
- ์ค์ฝํ
- ์ฌ์ฉ์ฑ ๊ฐ์
Archives
- Today
- Total
Lennon FE
[ํ๋ก๊ทธ๋๋จธ์ค] ์์ด ๋๋ง์๊ธฐ (js) ๋ณธ๋ฌธ
728x90
๋ฐ์ํ
https://programmers.co.kr/learn/courses/30/lessons/12981?language=javascript
function solution(n, words) {
let result = [words[0],];
let answer = 0;
for(let i = 0; i < words.length; i++){
if(result.includes(words[i+1])){
answer = i+2;
break;
}
if(i < words.length-1 && words[i][words[i].length-1] !== words[i+1][0]){
answer = i+2;
break;
}
result.push(words[i+1]);
}
return answer===0 ? [0,0] : [ answer%n===0 ? n : answer%n, Math.ceil(answer/n)]
}
๋จ์ํ ๊ตฌํ ๋ฌธ์ ์ด๋ค.
์์๋ ์ฐจ๋ก๋ฅผ ์ ์๊ฐํด returnํ๋ฉด ์ฝ๊ฒ ํ๋ฆด ์ ์๋ค.
728x90
๋ฐ์ํ
'๐ฅ Algorithm > Programmers' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ํ๋ก๊ทธ๋๋จธ์ค] ๊ดํธ ๋ณํ (js) (0) | 2021.11.04 |
---|---|
[ํ๋ก๊ทธ๋๋จธ์ค] ๋ฌธ์์ด ์์ถ (js) (0) | 2021.11.03 |
[ํ๋ก๊ทธ๋๋จธ์ค] ์์ ์ต๋ํ (js) (0) | 2021.10.31 |
[ํ๋ก๊ทธ๋๋จธ์ค] 1์ฐจ ํ๋ ์ฆ4๋ธ๋ก (js) (0) | 2021.10.31 |
[ํ๋ก๊ทธ๋๋จธ์ค] ๊ฑฐ๋ฆฌ๋๊ธฐ ํ์ธํ๊ธฐ (js) (0) | 2021.10.30 |
Comments