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๋ฒ js
- ์๋ฐ์คํฌ๋ฆฝํธ ์ค์ฝํ
- suspense react-query
- emotion RSC
- ๊ตฌ๋ฆํค ์ฑ๋ฆฐ์ง ํ๊ณ
- ์นด์นด์ค ์ฝํ
- ์ต์ ๋์ฒด์ด๋
- emtion app router
- ๊ตฌ๋ฆํค ์ฑ๋ฆฐ์ง
- ๊ตฌ๋ฆํค
- ์๋ฐ์คํฌ๋ฆฝํธ ๋ฌธ์์ด ์์ถ
- ํ๋ก๊ทธ๋๋จธ์ค ๋ฌธ์์ด ์์ถ
- suspense ๋์์๋ฆฌ
- ์ค์ฝํ
- ์ฌ์ฉ์ฑ ๊ฐ์
- ํ๋ก๊ทธ๋๋จธ์ค ๊ฑฐ๋ฆฌ๋๊ธฐ ํ์ธํ๊ธฐ
- suspense ๋น๋๊ธฐ
- ๋ฆฌ์กํธ์ฟผ๋ฆฌ suspense
- js
- ๋ฐฑ์ค 1339๋ฒ ์๋ฐ์คํฌ๋ฆฝํธ
- js ๊ฑฐ๋ฆฌ๋๊ธฐ ํ์ธํ๊ธฐ
- ๋ฐฑ์ค 2108 ์๋ฐ์คํฌ๋ฆฝํธ
- app router emotion
- js ๋ฌธ์์ด ์์ถ
- ๋ฐฑ์ค 2108 nodejs
- TypeError: createContext only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more:
- next13 emotion
- suspense ๋ณ๋ชฉํ์
- js ์ค์ฝํ
- ๋ฐฑ์ค 1339๋ฒ nodejs
Archives
- Today
- Total
Lennon FE
[๋ฐฑ์ค 1316๋ฒ] ๊ทธ๋ฃน ๋จ์ด ์ฒด์ปค - ์๋ฐ์คํฌ๋ฆฝํธ(nodejs) ๋ณธ๋ฌธ
๐ฅ Algorithm/Baekjoon
[๋ฐฑ์ค 1316๋ฒ] ๊ทธ๋ฃน ๋จ์ด ์ฒด์ปค - ์๋ฐ์คํฌ๋ฆฝํธ(nodejs)
Lennon 2022. 1. 17. 05:12728x90
๋ฐ์ํ
https://www.acmicpc.net/problem/1316
const fs = require('fs');
let input = fs.readFileSync('/dev/stdin').toString().trim().split('\n');
let inputCount = input.shift();
input.filter((v) => {
const arr = [];
let str = '';
for (let i = 1; i < v.length; i++) {
if (v[i - 1] === v[i]) {
str += v[i - 1];
} else {
str += v[i - 1];
arr.push(str);
str = '';
}
if (i === v.length - 1) {
str += v[i];
arr.push(str);
}
}
const arr2 = arr.map((v) => v[0]);
const set = new Set(arr2);
const unique = [...set];
if (unique.length !== arr.length) {
inputCount--;
}
});
console.log(inputCount);
happyp => ['h', 'a', 'pp', 'y', 'p'] => ['h', 'a', 'p', 'y', 'p'] => ์ค๋ณต์ ๊ฑฐ => ['h','a','p','y'] => ๊ธธ์ด๊ฐ ๋ค๋ฆ
=> inputCount -- ์ ์ฉ!
๋ณ์๋ฅผ ์ต์ํ ํ๊ธฐ์ํด inputCount๋ฅผ ์ ์ธํ๋ฉฐ ์ฒซ ๋ฒ์งธ input๊ฐ์ ์์ด๋ค.
728x90
๋ฐ์ํ
'๐ฅ Algorithm > Baekjoon' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Comments