본문 바로가기

컴퓨터/프로그래머스

(75)
프로그래머스 - 49993번: 스킬트리 [Java] 문제: https://school.programmers.co.kr/learn/courses/30/lessons/49993 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 1. 코드 import java.util.*; class Solution { public int solution(String skill, String[] skill_trees) { int answer = 0; for(String s : skill_trees) { Map map = new HashMap(); for(int i = 0; i < s.length(); i++) map.put(s.c..
프로그래머스 - 42584번: 주식가격 [Java] 문제: https://school.programmers.co.kr/learn/courses/30/lessons/42584 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 1. 코드 import java.util.*; class Solution { public List solution(int[] prices) { List answer = new ArrayList(); for(int i = 0; i < prices.length - 1; i++) { int cnt = 0; for(int j = i + 1; j < prices.length; j++) { cnt++..
프로그래머스 - 49994번: 방문 길이 [Java] 문제: https://school.programmers.co.kr/learn/courses/30/lessons/49994 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 1. 코드 class Solution { static int answer = 0; public int solution(String dirs) { int[][] move = { {1, 0}, {-1, 0}, {0, 1}, {0, -1} }; boolean[][][][] visit = new boolean[11][11][11][11]; int[] position = {5, 5}; for(cha..
프로그래머스 - 1844번: 게임 맵 최단거리 [Java] [실패] 문제: https://school.programmers.co.kr/learn/courses/30/lessons/1844 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 1. 코드 import java.util.LinkedList; import java.util.Queue; class Solution { public int solution(int[][] maps) { int n = maps.length; int m = maps[0].length; int[][] distance = new int[n][m]; for (int i = 0; i < n; i++) {..
프로그래머스 - 84512번: 모음사전 [Java] 문제: https://school.programmers.co.kr/learn/courses/30/lessons/84512 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 1. 코드 class Solution { static int answer = 0; static int cnt = 1; public int solution(String word) { char[] vowel = {'A', 'E', 'I', 'O', 'U'}; StringBuilder sb = new StringBuilder(); dfs(word, vowel, sb); return answer;..
프로그래머스 - 42888번: 오픈채팅방 [Java] 문제: https://school.programmers.co.kr/learn/courses/30/lessons/42888 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 1. 코드 import java.util.*; class Solution { public List solution(String[] record) { List list = new ArrayList(); Map map = new HashMap(); for(String r : record) { String[] s = r.split(" "); list.add(s[1] + " "+ s[0]); if..
프로그래머스 - 43163번: 단어 변환 [Java] (실패) 문제: https://school.programmers.co.kr/learn/courses/30/lessons/43163 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 1. 코드 import java.util.*; class Solution { static int answer = Integer.MAX_VALUE; static boolean[] check; public int solution(String begin, String target, String[] words) { check = new boolean[words.length]; dfs(begin, ..
프로그래머스 - 42626번: 더 맵게 [Java] 문제: https://school.programmers.co.kr/learn/courses/30/lessons/42626 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 1. 코드 import java.util.*; class Solution { public int solution(int[] scoville, int K) { int answer = 0; PriorityQueue queue = new PriorityQueue(); for(int s : scoville) queue.offer(s); while(queue.peek() < K && queue.si..