투 포인터

    백준 / 투 포인터 / 22862번 / 가장 긴 짝수 연속한 부분 수열 (large) / JS

    문제 간단설명길이가 N인 수열 S가 있다. 수열 S는 1이상 정수로 이루어져 있는데,최대 K개의 정수를 삭제할 수 있다. 최대 K개 삭제한 수열에서,짝수로 이루어져 있는 연속한 부분 수열 중,가장 긴 길이를 구하면 된다. 제한 사항1 1 1  성공 코드const fs = require('fs');const filePath = process.platform === 'linux' ? '/dev/stdin' : '../input.txt';// const filePath = process.platform === 'linux' ? '/dev/stdin' : 'BOJ/input.txt';const input = fs .readFileSync(filePath) .toString() .trim() .split(..

    백준 / 투 포인터 / 1644번 / 소수의 연속합 / JS

    1644번: 소수의 연속합 첫째 줄에 자연수 N이 주어진다. (1 ≤ N ≤ 4,000,000) www.acmicpc.net /* 소수의 연속합 */ const fs = require('fs'); // const filePath = process.platform === 'linux' ? '/dev/stdin' : '../input.txt'; const filePath = process.platform === 'linux' ? '/dev/stdin' : 'BOJ/input.txt'; const input = fs.readFileSync(filePath).toString().trim().split('\n'); const N = +input.shift(); function solution..

    백준 / 투 포인터 / 2470번 / 두 용액 / JS

    2470번: 두 용액 첫째 줄에는 전체 용액의 수 N이 입력된다. N은 2 이상 100,000 이하이다. 둘째 줄에는 용액의 특성값을 나타내는 N개의 정수가 빈칸을 사이에 두고 주어진다. 이 수들은 모두 -1,000,000,000 이상 1,000,00 www.acmicpc.net /* 두 용액 */ const fs = require('fs'); // const filePath = process.platform === 'linux' ? '/dev/stdin' : '../input.txt'; const filePath = process.platform === 'linux' ? '/dev/stdin' : 'BOJ/input.txt'; const input = fs.readFileSync(..