17686. 파일명 정렬
·
Algorithm/Programmers
문제https://school.programmers.co.kr/learn/courses/30/lessons/17686풀이import java.util.*;class Solution { // File 클래스 class File { String head; int number; int tailIndex; String origin; public File(String head, int number, int tailIndex, String origin) { this.head = head; this.number = number; this.tailIndex = tailInd..
155651. 호텔 대실
·
Algorithm/Programmers
문제https://school.programmers.co.kr/learn/courses/30/lessons/155651 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr제한조건풀이import java.util.*;class Solution { public int solution(String[][] book_time) { int answer = 0; List tList = new ArrayList(); PriorityQueue pq = new PriorityQueue(); for(String[] tArr : book_time) { ..
154540. 무인도 여행
·
Algorithm/Programmers
문제https://school.programmers.co.kr/learn/courses/30/lessons/154540 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr제한사항풀이import java.util.*;class Solution { public int[] solution(String[] maps) { int[] answer = {}; List result = new ArrayList(); int n = maps.length; int m = maps[0].length(); int[][] mapArr =new int ..
159993. 미로탈출
·
Algorithm/Programmers
문제https://school.programmers.co.kr/learn/courses/30/lessons/159993제한사항풀이import java.util.*;class Solution { public int solution(String[] maps) { int answer = 0; int n = maps.length; int m = maps[0].length(); char[][] mapArr = new char[n][m]; int[] start = new int[2]; int[] end = new int[2]; int[] lever = new int[2]; ..
340211. 충돌위험 찾기
·
Algorithm/Programmers
문제https://school.programmers.co.kr/learn/courses/30/lessons/169199제한사항풀이import java.util.*;class Solution { public int solution(int[][] points, int[][] routes) { int answer = 0; int[][] pointMap = new int[101][101]; int n = routes.length; // 로봇들의 경로 집합 List> paths = new ArrayList(); // 경로 추적 for(int[] route : routes) { ..
169199. 리코챗 로봇
·
Algorithm/Programmers
문제https://school.programmers.co.kr/learn/courses/30/lessons/169199 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr제한사항풀이import java.util.*;class Solution { public int solution(String[] board) { int answer = 0; int n = board.length; int m = board[0].length(); char[][] boardMap = new char[n][m]; int[] start= ..
388353. 지게차와 크레인
·
Algorithm/Programmers
문제https://school.programmers.co.kr/learn/courses/30/lessons/388353제한사항풀이1. 창고 맵을 초기화한다. 외부를 구분하기 위해 기존 창고 겉에 외부 빈공간을 구분할 수 있는 배열을 추가한다.1.1 외부 빈공간은 '0', 내부 빈공간은 '1'로 설정했다.2. 크레인, 지게차 로직 구현한다. 2.1 크레인, 지게차가 컨테이너를 제거하면 외부 빈 공간('0')이 생길 수 있다. 그 빈 공간이 내부 빈 공간에 영향을 주는지 확인한다. 외부 빈 공간이 생기면서 주변 내부 빈 공간('1')이 외부 빈 공간('0')이 될 수 있다.import java.util.*;class Solution { public int solution(String[] storage,..
258711. 도넛과 막대 그래프
·
Algorithm/Programmers
문제https://school.programmers.co.kr/learn/courses/30/lessons/258711 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr제한사항풀이1. indegree, outdegree 맵을 초기화한다.2. 각 그래프 패턴을 특정하는 노드는 확인 후 그래프 패턴 개수를 더한다.3. 더 중요한 핵심은 그래프 패턴을 특정하는 노드 외에는 그냥 넘길 수 있다는 것을 눈치채는 것이라 생각한다.import java.util.*;class Solution { public int[] solution(int[][] edges) { int[] answer = {}; ..
150368. 이모티콘 할인행사
·
Algorithm/Programmers
문제https://school.programmers.co.kr/learn/courses/30/lessons/150368제한사항풀이1. DFS를 사용하여 모든 할인율 조합 생성2. 각 할인 조합에 대해 사용자 구매 시뮬레이션3. 최적의 결과 저장class Solution { static int maxSubscriberCount = 0; static int maxCost = 0; public int[] solution(int[][] users, int[] emoticons) { int[] answer = {}; int[] discountRates = {10, 20, 30, 40}; int[] discountCombination = new int[emoti..