목록자료구조 (2)
HIT해
https://www.acmicpc.net/problem/28279 28279번: 덱 2 첫째 줄에 명령의 수 N이 주어진다. (1 ≤ N ≤ 1,000,000) 둘째 줄부터 N개 줄에 명령이 하나씩 주어진다. 출력을 요구하는 명령은 하나 이상 주어진다. www.acmicpc.net 아래는 내 첫 풀이이다. const filePath = process.platform === 'linux' ? '/dev/stdin' : 'input.txt'; const input = require("fs") .readFileSync(filePath) .toString() .trim() .split("\n"); let TC = input.shift(); //console.log(input); let deck = []; fo..
const filePath = process.platform === 'linux' ? '/dev/stdin' : 'input.txt'; const input = require("fs") .readFileSync(filePath) .toString() .trim() .split("\n"); let TC = input.shift(); hey : for(let i = 0; i < TC; i++){ let tmp = input.shift(); tmp = tmp.trim(); let num = tmp.length; let count = 0; let flag = true; for(let j = 0; j < num; j++){ if(tmp[j] === '('){ count++; }else{ count--; } if(..