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 |
Tags
- suspense ๋ณ๋ชฉํ์
- ๊ตฌ๋ฆํค ์ฑ๋ฆฐ์ง ํ๊ณ
- ์ค์ฝํ
- ํ๋ก๊ทธ๋๋จธ์ค ๊ฑฐ๋ฆฌ๋๊ธฐ ํ์ธํ๊ธฐ
- emotion RSC
- js ์ค์ฝํ
- ๋ฆฌ์กํธ์ฟผ๋ฆฌ suspense
- ํ๋ก๊ทธ๋๋จธ์ค ๋ฌธ์์ด ์์ถ
- app router emotion
- ๋ฐฑ์ค 1339๋ฒ js
- js
- ์ต์ ๋์ฒด์ด๋
- ๊ตฌ๋ฆํค
- TypeError: createContext only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more:
- ๋ฐฑ์ค 2108 nodejs
- suspense ๋์์๋ฆฌ
- ์๋ฐ์คํฌ๋ฆฝํธ ๋ฌธ์์ด ์์ถ
- suspense react-query
- ๋ฐฑ์ค 1339๋ฒ nodejs
- js ๋ฌธ์์ด ์์ถ
- ๊ตฌ๋ฆํค ์ฑ๋ฆฐ์ง
- suspense ๋น๋๊ธฐ
- ๋ฐฑ์ค 2108 ์๋ฐ์คํฌ๋ฆฝํธ
- ์นด์นด์ค ์ฝํ
- ์๋ฐ์คํฌ๋ฆฝํธ ์ค์ฝํ
- next13 emotion
- ์ฌ์ฉ์ฑ ๊ฐ์
- ๋ฐฑ์ค 1339๋ฒ ์๋ฐ์คํฌ๋ฆฝํธ
- js ๊ฑฐ๋ฆฌ๋๊ธฐ ํ์ธํ๊ธฐ
- emtion app router
Archives
- Today
- Total
Lennon FE
[ํ๋ก๊ทธ๋๋จธ์ค Lv.3] ์ด์ค์ฐ์ ์์ํ (js) ๋ณธ๋ฌธ
๐ฅ Algorithm/Programmers
[ํ๋ก๊ทธ๋๋จธ์ค Lv.3] ์ด์ค์ฐ์ ์์ํ (js)
Lennon 2022. 2. 3. 03:42728x90
๋ฐ์ํ
https://programmers.co.kr/learn/courses/30/lessons/42628?language=javascript
์ฝ๋ฉํ ์คํธ ์ฐ์ต - ์ด์ค์ฐ์ ์์ํ
programmers.co.kr
function solution(operations) {
let queue = [];
operations.filter((a) => {
if(a[0] === "I") queue.push(parseInt(a.slice(2,a.length)));
else if(a === "D 1" && queue.length > 0){
let max = Math.max(...queue);
queue.splice(queue.indexOf(max), 1);
}
else if(a === "D -1" && queue.length > 0){
let min = Math.min(...queue);
queue.splice(queue.indexOf(min), 1);
}
})
return queue.length === 0 ? [0,0] : [Math.max(...queue), Math.min(...queue)]
}
์ต๋ํ, ์ต์ํ์ ๊ตฌํ์ง ์์๋ ์ฝ๊ฒ ํ๋ฆฌ๊ธดํ๋ค. Lv.3 ์์ค์ด๋ฉด ํจ์จ์ฑ์ด ๋ค์ด์์ ์ค ์์๋๋ฐ, ์ ๋ค์ด๊ฐ ์์ด์ ๊ทธ๋ฅ ์ ์ถํ๋ค.
728x90
๋ฐ์ํ
'๐ฅ Algorithm > Programmers' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ํ๋ก๊ทธ๋๋จธ์ค Lv.3] ์ ๊ตญ์ฌ์ฌ (0) | 2022.03.01 |
---|---|
[ํ๋ก๊ทธ๋๋จธ์ค] ๋ค๋ฆฌ๋ฅผ ์ง๋๋ ํธ๋ญ (js) (0) | 2022.02.10 |
[ํ๋ก๊ทธ๋๋จธ์ค Lv.3] ๋ถ๋ ์ฌ์ฉ์ (js) (0) | 2022.02.03 |
[ํ๋ก๊ทธ๋๋จธ์ค Lv.3] ๋จ์ ์นด๋ฉ๋ผ (js) (0) | 2022.01.30 |
[ํ๋ก๊ทธ๋๋จธ์ค Lv.2] 2๊ฐ ์ดํ๋ก ๋ค๋ฅธ ๋นํธ (js) (0) | 2022.01.30 |
Comments