목록IT (140)
언젠가는 펼쳐 볼 아카이브

사용언어 : javascript lv.3 문제 풀이 소요 시간 : 48분 45초 #문제 #제출코드 function solution(n, s) { if(n>s) return [-1]; let answer = [] for(let i = n; i > 0; i--){ const num = Math.floor(s/i); answer.push(num); s-=num; } return answer; }

# 우리 어디서 본적 있지 않나요🤔 리액트로 프로젝트를 개발하다보면, 크롬 개발자 콘솔창에서 자주 보이는 "warning" 친구가 있다. 경고문 예시 코드 import data from './data.json'; function App() { return ( {data.map((item) => { return ( {/* "p" 태그에 key값을 설정해 주지 않음*/} Name : {item.name}, Age : {item.age} ); })} ); } export default App; 바로 이 친구인데, 리액트 컴포넌트를 생성하는 방법 중 데이터 값을 불러와 반복문으로 child component를 생성할 때 key 값을 설정하는 걸 놓치면 생기는 warning 친구다. 프로젝트를 개발 하다보면 종종..

사용언어 : javascript lv.3 문제 풀이 소요 시간 : 21분 46초 #문제 #제출코드 function solution(n, works) { let answer = 0; let totalWork = works.reduce((total, curr)=> total+curr, 0); if(totalWork b - a); while(n){ let max = sorted[0]; for(let i=0; i= max){ sorted[i] -= 1; n -= 1; } if(!n) break; } } return works.reduce((total, curr) => total +=Math.pow(curr, 2), 0); }

사용언어 : javascript lv.3 문제풀이 소요 시간 : 5분 21초 문제 유형 : 힙(Heap) #문제 #제출코드 function solution(operations) { let queue = []; operations.map(operator => { const [op , num] = operator.split(" "); if(op === "I"){ queue.push(+num); queue.sort((a, b) => a-b); } if(op === "D" && queue.length > 0){ if(num === "-1"){ queue.shift(); }else { queue.pop(); } } }) return queue.length > 0 ? [queue[queue.length-1], qu..