[백준] 11053번: 가장 긴 증가하는 부분 수열 (JavaScript)
·
PS
문제https://www.acmicpc.net/problem/11053 개념동적 계획법(DP)   구현 코드(JavaScript)const fs = require('fs');// 백준 제출용let input = fs.readFileSync('/dev/stdin').toString().trim().split('\n');// 로컬 테스트용// const filePath =// process.platform === 'linux' ? '/dev/stdin' : __dirname + '/input.txt';// const input = fs.readFileSync(filePath).toString().trim().split('\n');const n = Number(input[0]);const arr = inp..
[백준] 15926번: 현욱은 괄호왕이야!! (JavaScript)
·
PS
문제https://www.acmicpc.net/problem/15926 개념자료구조, 스택  실행 결과   구현 코드(js)const fs = require('fs');// 백준 제출용let input = fs.readFileSync('/dev/stdin').toString().trim().split('\n');// 로컬 테스트용// const filePath =// process.platform === 'linux' ? '/dev/stdin' : __dirname + '/input.txt';// let input = fs.readFileSync(filePath).toString().trim().split('\n');// 15926번 현우는 괄호왕이야!!const n = Number(input.shi..
[백준] 1914번 - 하노이 탑 (JavaScript)
·
PS
문제https://www.acmicpc.net/problem/1914  개념재귀 호출큰 수 연산  실행 결과    구현 코드(js)/*1914번 하노이 탑 자바스크립트 https://www.acmicpc.net/problem/1914오버플로우 해결 => BigInthttps://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/BigInt*/const fs = require('fs');const input = fs.readFileSync(0).toString().trim().split('\n');let n = Number(input[0]);let resArr = [];// 로컬 테스트용// const filePath =// p..
[백준] 10814번: 나이순 정렬
·
PS
문제https://www.acmicpc.net/problem/10814  개념정렬  실행 결과     구현 코드(c++)#include #include #include using namespace std;// 정렬 기준 - 나이 오름차순bool comp(const pair& a, const pair& b) { return a.first > n; vector> arr(n); for (int i = 0; i > arr[i].first >> arr[i].second; } // 안정적인 정렬 사용 stable_sort(arr.begin(), arr.end(), comp); for (const auto& member : arr) { cout     코드 설명먼저 나는 일반 sort 함수를 사용했..
[백준] 9935번: 문자열 폭발
·
PS
문제https://www.acmicpc.net/problem/9935  개념문자열, 스택  실행 결과    구현 코드(c++)#include #include using namespace std;int main() { string a, b, res; cin >> a >> b; for (char c : a) { res += c; if (res.size() >= b.size()) { int idx = res.size() - b.size(); if (res.substr(idx) == b) res.erase(idx); } } cout     코드 설명처음 문제를 풀 때는 스택 자료구조를 사용했다. 문자열의 인덱스를 이용해 한 글자씩 스택에 넣고 폭발 문자열과..