프로그래머스(자바)

    가위 바위 보 게임 - setTimeout, setInterval + 함수 객체

    html파일 가위 바위 보 0 script파일 const $computer = document.querySelector("#computer"); const $rock = document.querySelector("#rock"); const $scissors = document.querySelector("#scissors"); const $score = document.querySelector("#score"); const $paper = document.querySelector("#paper"); const IMG_URL = "./rsp.png"; $computer.style.background = `url(${IMG_URL}) -464px 0`; $computer.style.backgroundSize ..

    주차 요금 계산 → 사람이 풀 수 있는 것인가?

    다른 사람의 풀이 import java.util.*; class Solution { public int convert(String time){ String[] split = time.split(":"); return Integer.parseInt(split[0])*60 +Integer.parseInt(split[1]); } HashMap intime = new HashMap(); TreeMap result = new TreeMap(); public int[] solution(int[] fees, String[] records) { for(int i=0; i

    H-index → "자바"

    이해를 돕기 위해서 아래 설명을 덧붙인다. 해당 논문이 인용된 수 : [9, 7, 6, 1] 발표된 논문의 수 : [1, 2, 3, 4] return 3 해설 첫번째 경우를 살펴보면, 논문을 1개 발표했는데, "해당 논문"이 다른 곳에서 9번 인용되었다는 의미이므로 "good"이다라고 볼 수 있고, 마지막의 경우를 살펴보면, 논문을 4개 발표했는데, "해당 논문"은 다른 곳에서 1번 인용되었다는 의미이므로 'bad"라고 볼 수 있다. →우리의 목표는 인용된 수가 발표된 논문의 수와 같거나 인용된 수가 발표된 논문의 수보다 큰 "경우의 수"를 구하는 것이다. 즉 "good"인 경우를 찾겠다는 의미이다. 해당 논문이 인용된 수 : [15, 12, 10, 8, 6, 3, 2, 1] 발표된 논문 수) : [ 1..

    더 맵게→ Priority Queue★★+poll()+peek()

    나의 풀이 import java.util.PriorityQueue; public class Solution { public static int solution(int[] scoville, int K) { int cnt = 0; PriorityQueue heap = new PriorityQueue(); for (int x : scoville) { heap.add(x); } if (heap.peek() >= K) { return cnt; } while (heap.size() > 1) { int min1 = heap.poll(); int min2 = heap.poll(); int newScoville = min1 + (min2 * 2); heap.add(newScoville); cnt++; if (heap.p..