[과제] JS 프로그래머스 Lv.2 2문제 (25.02.24)
·
LG 유플러스 유레카 SW/과제
1. 피보나치 수DP로 풀기function solution(n) { let a = 0, b = 1; for (let i = 2; i 2. 짝지어 제거하기Stack 활용function solution(s) { const stack = []; for (let char of s) { if (stack.length > 0 && stack[stack.length - 1] === char) { stack.pop(); // 짝이 맞으면 제거 } else { stack.push(char); // 짝이 아니면 추가 } } return stack.length === 0 ? 1 : 0;}