두 개 뽑아서 더하기1 [프로그래머스][자바스크립트][Level1] 두 개 뽑아서 더하기 /** * 두개뽑아서더하기.js * https://programmers.co.kr/learn/courses/30/lessons/68644?language=javascript */ // combination function solution(numbers) { const numSet = new Set(getCombinationsSum(numbers, 2)); return Array.from(numSet).sort((a, b) => a - b); } function getCombinationsSum(array, selectedNum) { const results = []; if (selectedNum === 1) { return [...array]; } array.forEach((fix, idx, orgArr.. 2022. 1. 6. 이전 1 다음