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
- suspense ๋น๋๊ธฐ
- ๊ตฌ๋ฆํค ์ฑ๋ฆฐ์ง
- ๋ฆฌ์กํธ์ฟผ๋ฆฌ suspense
- ํ๋ก๊ทธ๋๋จธ์ค ๊ฑฐ๋ฆฌ๋๊ธฐ ํ์ธํ๊ธฐ
- ๋ฐฑ์ค 1339๋ฒ ์๋ฐ์คํฌ๋ฆฝํธ
- js
- app router emotion
- ํ๋ก๊ทธ๋๋จธ์ค ๋ฌธ์์ด ์์ถ
- ๋ฐฑ์ค 2108 nodejs
- ๋ฐฑ์ค 1339๋ฒ nodejs
- js ์ค์ฝํ
- suspense react-query
- emtion app router
- suspense ๋ณ๋ชฉํ์
- ์ต์ ๋์ฒด์ด๋
- emotion RSC
- ์๋ฐ์คํฌ๋ฆฝํธ ์ค์ฝํ
- TypeError: createContext only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more:
- js ๋ฌธ์์ด ์์ถ
- ์ฌ์ฉ์ฑ ๊ฐ์
- ๊ตฌ๋ฆํค
- suspense ๋์์๋ฆฌ
- ์นด์นด์ค ์ฝํ
- ๊ตฌ๋ฆํค ์ฑ๋ฆฐ์ง ํ๊ณ
- ์ค์ฝํ
- ์๋ฐ์คํฌ๋ฆฝํธ ๋ฌธ์์ด ์์ถ
- js ๊ฑฐ๋ฆฌ๋๊ธฐ ํ์ธํ๊ธฐ
- ๋ฐฑ์ค 1339๋ฒ js
- next13 emotion
- ๋ฐฑ์ค 2108 ์๋ฐ์คํฌ๋ฆฝํธ
Archives
- Today
- Total
Lennon FE
[๋ฐฑ์ค 10828๋ฒ] ์คํ - ์๋ฐ์คํฌ๋ฆฝํธ(nodejs) ๋ณธ๋ฌธ
๐ฅ Algorithm/Baekjoon
[๋ฐฑ์ค 10828๋ฒ] ์คํ - ์๋ฐ์คํฌ๋ฆฝํธ(nodejs)
Lennon 2022. 1. 20. 15:06728x90
๋ฐ์ํ
https://www.acmicpc.net/problem/10828
const fs = require('fs');
let input = fs.readFileSync('dev/stdin').toString().trim().split('\n');
const stack = [];
const result = [];
const repeatLen = input.shift();
for (let i = 0; i < repeatLen; i++) {
switch (input[i]) {
case 'pop':
result.push(stack.pop() || -1);
break;
case 'size':
result.push(stack.length);
break;
case 'empty':
result.push(stack[0] ? 0 : 1);
break;
case 'top':
result.push(stack[stack.length - 1] || -1);
break;
default:
stack.push(input[i].split(' ')[1]);
break;
}
}
console.log(result.join('\n'));
input ์ต๋๊ฐ์ด 10,000์ด๋ฏ๋ก for๋ฌธ์์์ console.log๋ฅผ ์ฐ๊ฒ๋๋ฉด ์๊ฐ์ ํ 0.5์ด ๋ฌธ์ ์์ ์๊ฐ์ด๊ณผ๊ฐ ๋ ํ๋ฅ ์ด ๋๋ค.
switch๋ฌธ์์ ๋จ์ถ ํ๊ฐ๋ฅผ ์ด์ฉํด result ๋ฐฐ์ด์ pushํ๊ณ ๋ง์ง๋ง์ join์ ์ด์ฉํด result ๋ฐฐ์ด์ ๋ค์ฌ์ฐ๊ธฐ ์ถ๋ ฅํ๋ฉด ๋๋ค.
728x90
๋ฐ์ํ
'๐ฅ Algorithm > Baekjoon' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค 9012๋ฒ] ๊ดํธ - ์๋ฐ์คํฌ๋ฆฝํธ(nodejs) (0) | 2022.01.20 |
---|---|
[๋ฐฑ์ค 10773๋ฒ] ์ ๋ก - ์๋ฐ์คํฌ๋ฆฝํธ(nodejs) (0) | 2022.01.20 |
[๋ฐฑ์ค 18870๋ฒ] ์ขํ ์์ถ - ์๋ฐ์คํฌ๋ฆฝํธ(nodejs) (0) | 2022.01.19 |
[๋ฐฑ์ค 2751๋ฒ] ์ ์ ๋ ฌํ๊ธฐ2 - ์๋ฐ์คํฌ๋ฆฝํธ(nodejs) (0) | 2022.01.19 |
[๋ฐฑ์ค 7568๋ฒ] ๋ฉ์น - ์๋ฐ์คํฌ๋ฆฝํธ(nodejs) (0) | 2022.01.18 |
Comments