Lv2

문제 설명 https://school.programmers.co.kr/learn/courses/30/lessons/84512 제한 사항 입출력 예 풀이 class Solution { String[] strArr = new String[] { "A", "E", "I", "O", "U" }; String answer; int count = 0; public int solution(String word) { answer = word; for (int i = 0; i < 5; i++) if(doDfs("", strArr[i])) return count; return -1; } private boolean doDfs(String result, String addStr) { StringBuilder tempWord..
문제 설명 https://school.programmers.co.kr/learn/courses/30/lessons/1844 제한 사항 입출력 예 풀이 import java.util.HashSet; class Solution { HashSet openSet = new HashSet(); HashSet closedSet = new HashSet(); HashSet newOpenSet; public int solution(int[][] maps) { openSet.add(0); // 출발지 return doBfs(maps, 1); } public int doBfs(int[][] maps, int answer) { newOpenSet = new HashSet(); int count = 0; for (Intege..
문제 설명 https://school.programmers.co.kr/learn/courses/30/lessons/42626 제한 사항 입출력 예 풀이 import java.util.PriorityQueue; class Solution { public int solution(int[] scoville, int K) { PriorityQueue result = new PriorityQueue(); int answer = 0; for (int i : scoville) result.add(i); while(result.peek() < K && result.size() != 1) { result.add(result.poll() + result.poll() * 2); answer++; } return result..
문제 설명 https://school.programmers.co.kr/learn/courses/30/lessons/92341 제한 사항 입출력 예 풀이 import java.util.HashMap; import java.util.Map; import java.util.ArrayList; class Solution { public int[] solution(int[] fees, String[] records) { ArrayList answer = new ArrayList(); HashMap recordMap = new HashMap(); HashMap result = new HashMap(); final int endOfDay = 23 * 60 + 59; for (int i = 0; i < records...
문제 설명 https://school.programmers.co.kr/learn/courses/30/lessons/17687 제한 사항 문제 참고 입출력 예 풀이 class Solution { public String solution(int n, int t, int m, int p) { String answer; StringBuilder result = new StringBuilder(); for (int i = 0; i
문제 설명 https://school.programmers.co.kr/learn/courses/30/lessons/17684 제한 사항 문제 참고 입출력 예 풀이 import java.util.HashMap; import java.util.ArrayList; class Solution { public int[] solution(String msg) { ArrayList answer = new ArrayList(); HashMap indexMap = new HashMap(); int pre = 0, post = 1; for (int i = 65; i < 91; i++) indexMap.put(String.valueOf((char)i), i - 64); while (post < msg.length()) { ..
megamaker
'Lv2' 태그의 글 목록 (6 Page)