안녕하세요.이어서 정답률 53% 문제를 풀어보겠습니다.function solution(denum1, num1, denum2, num2) { var answer = [denum1*num2+denum2*num1,num1*num2]; for(let i = num1*num2; i> 0;i--){ if(answer[0]%i===0&&answer[1]%i===0){ answer[0]=answer[0]/i; answer[1]=answer[1]/i; } } return answer;}제가 생각한 제 코드의 핵심은 가장 큰 수부터 나누는것입니다.처음에 반대로 작은수부터 나눴더니 오류가 났습니다. 최대한 큰 수로 먼저 나눠야 오류가 나..
안녕하세요.오늘은 이어서 정답률 53% 문제를 풀어보겠습니다.function solution(num, total) { var answer = []; if(num>=total){ if(total !== 0){ for(let i = -total;i0;i--){ let tot = 0; for(let j=i;j>i-num;j--){ tot+=j; } if(tot === total){ for(let j=i;j>i-num;j--){ answer.push(j) } ..
안녕하세요.오늘은 정답률 57%문제를 풀어보겠습니다.function solution(common) { var answer = 0; common[1]*2-common[0] === common[2]?answer=common[0]+(common[1]-common[0])*common.length:answer= common[0]*((common[1]/common[0])**common.length); return answer;}
안녕하세요.이어서 정답률 58%문제를 풀어보겠습니다.생각보다 간단하게 풀 수 있는 문제였습니다.function solution(quiz) { var answer = []; quiz.map(x =>eval(x.slice(0,x.indexOf('='))) === parseInt(x.slice(x.indexOf('=')+1))?answer.push("O"):answer.push("X")) return answer;}
안녕하세요.오늘은 정답률 60% 문제를 해결해보겠습니다.function solution(polynomial) { let x = 0; let n = 0; let answer = ''; polynomial.split(" + ").map(el=> el.includes('x')?el==='x'?x+=1:x+=parseInt(el.replace('x','')):n+=parseInt(el)); if(x!==0){ x === 1?answer = 'x':answer=x+'x'; if(n>0){ answer += ' + '+n; } } else{ answer = String(n); } return ans..