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
- ๋ฐฑ์ค 2108 nodejs
- ์นด์นด์ค ์ฝํ
- ํ๋ก๊ทธ๋๋จธ์ค ๊ฑฐ๋ฆฌ๋๊ธฐ ํ์ธํ๊ธฐ
- suspense ๋์์๋ฆฌ
- app router emotion
- ์ค์ฝํ
- ๊ตฌ๋ฆํค
- ๊ตฌ๋ฆํค ์ฑ๋ฆฐ์ง
- ์๋ฐ์คํฌ๋ฆฝํธ ์ค์ฝํ
- ๋ฆฌ์กํธ์ฟผ๋ฆฌ suspense
- 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:
- emotion RSC
- suspense ๋น๋๊ธฐ
- suspense ๋ณ๋ชฉํ์
- js ๋ฌธ์์ด ์์ถ
- ๋ฐฑ์ค 1339๋ฒ ์๋ฐ์คํฌ๋ฆฝํธ
- suspense react-query
- js
- js ๊ฑฐ๋ฆฌ๋๊ธฐ ํ์ธํ๊ธฐ
- ์ต์ ๋์ฒด์ด๋
- ๋ฐฑ์ค 2108 ์๋ฐ์คํฌ๋ฆฝํธ
- ๋ฐฑ์ค 1339๋ฒ nodejs
- ๋ฐฑ์ค 1339๋ฒ js
- js ์ค์ฝํ
- emtion app router
- ๊ตฌ๋ฆํค ์ฑ๋ฆฐ์ง ํ๊ณ
- ํ๋ก๊ทธ๋๋จธ์ค ๋ฌธ์์ด ์์ถ
Archives
- Today
- Total
Lennon FE
[ํ๋ก๊ทธ๋๋จธ์ค] ๋ฐฉ๊ธ ๊ทธ๊ณก (js) ๋ณธ๋ฌธ
728x90
๋ฐ์ํ
https://programmers.co.kr/learn/courses/30/lessons/17683?language=javascript
function solution(m, musicinfos) {
let melody;
let answer = [];
m = conversionMelody(m);
for(let i = 0; i < musicinfos.length; i++){
let v = musicinfos[i];
v = v.split(",");
v[3] = conversionMelody(v[3]);
const time = (v[1].slice(0,2)-v[0].slice(0,2))*60 + (v[1].slice(3)-v[0].slice(3))
const repeatCount = time/v[3].length;
const remainder = time % v[3].length;
if(repeatCount<1){
melody = v[3].slice(0,time);
}
else{
melody = v[3].repeat(repeatCount)+v[3].slice(0,time);
}
if(melody.includes(m)){
answer.push({value: v[2], time: time});
}
}
answer.sort((a,b) => b.time-a.time);
return answer.length===0 ? "(None)" : answer[0].value
}
function conversionMelody(m){
return m = m.replace(/C#/gi, 'c')
.replace(/D#/gi, 'd')
.replace(/F#/gi, 'f')
.replace(/G#/gi, 'g')
.replace(/A#/gi, 'a')
.replace(/E#/gi, 'e');
}
๋์ค์ ์ฒ๋ฆฌํ๊ธฐ ๊ท์ฐฎ์ #์ฒ๋ฆฌ๋ฅผ ๋ฉ๋ก๋์ ๋ณธ์ธ์ ๋ฉ๋ก๋์ ๋จผ์ ํด์ฃผ๊ณ
์๊ฐ์ ๊ตฌํ ํ ๋ฉ๋ก๋๋ฅผ ๊ทธ๋งํผ ๋ฐ๋ณตํด์ค๋ค.
๋ฐ๋ณตํ ๋ฉ๋ก๋์ ๋ณธ์ธ์ ๋ฉ๋ก๋๊ฐ includes ๋์ด์์ผ๋ฉด ๋ฐฐ์ด์ ๊ฐ์ฒด๋ก ์ ๋ชฉ๊ณผ ์๊ฐ์ ํจ๊ป ๋ฃ๋๋ค.
์ฌ๋ฌ๊ฐ๊ฐ ์์ผ๋ฉด ์๊ฐ์ด ๊ฐ์ฅ ํฐ ๋ฉ๋ก๋๋ฅผ ๋ฆฌํด / ํด๋น๋๋ ๊ฒ ์์ผ๋ฉด "(None)" ๋ฆฌํด ์ด๋ฏ๋ก
์๊ฐ ์์ผ๋ก ์ ๋ ฌ ํ ๋ฆฌํดํด์ฃผ๋ฉด ๋๋ค!
๋ฌธ์ ํ ๋ ์๊ตฌ์ฌํญ์ ์ ๋ฆฌํ๊ณ ํ๋ฉด ์ค๋ฅ๋ฅผ ํด๊ฒฐํ๋ ๋ฐ ์๊ฐ์ ์ ์ฝํ ์ ์๋ค.
๋ฌธ์ ๋ฅผ ๊ผผ๊ผผํ๊ฒ ์ฝ๊ณ ํ์!
728x90
๋ฐ์ํ
'๐ฅ Algorithm > Programmers' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ํ๋ก๊ทธ๋๋จธ์ค] 3์ฐจ ์์ถ (js) (0) | 2021.10.29 |
---|---|
[ํ๋ก๊ทธ๋๋จธ์ค] ์คํ์ฑํ ๋ฐฉ (js) (0) | 2021.10.28 |
[ํ๋ก๊ทธ๋๋จธ์ค] (1์ฐจ) ๋ด์ค ํด๋ฌ์คํฐ๋ง (js) (0) | 2021.10.27 |
[ํ๋ก๊ทธ๋๋จธ์ค] ์ํด๋ฆฌ์ฑ๋ฆฐ์ง 12์ฃผ์ฐจ (js) (0) | 2021.10.26 |
[ํ๋ก๊ทธ๋๋จธ์ค] ๋ฒ ์คํธ์จ๋ฒ (js) (0) | 2021.10.26 |
Comments