Problem Solving/Programmers
[프로그래머스, 181862] 세 개의 구분자 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/181862 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 118 MB, 시간: 26.03 ms사용 알고리즘: 문자열import java.util.*;class Solution { public String[] solution(String myStr) { StringTokenizer st = new StringTokenizer(myStr, "abc"); List list = new ArrayList(); while(st.ha..
[프로그래머스, 12921] 소수 찾기 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/12921 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 54.7 MB, 시간: 14.37 ms사용 알고리즘: 구현class Solution { public int solution(int n) { int answer = 0; // 소수가 아닌 것을 표시하는 배열 boolean[] isNotPrimeNumber = new boolean[n + 1]; for(int i = 2; i
[프로그래머스, 135808] 과일 장수 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/135808 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 144 MB, 시간: 48.32 ms사용 알고리즘: 정렬, 구현import java.util.*;class Solution { public int solution(int k, int m, int[] score) { // 정렬 Arrays.sort(score); int answer = 0; int lowerIndex = score.length - m; ..
[프로그래머스, 42840] 모의고사 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/42840 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 86.5 MB, 시간: 1.57 ms사용 알고리즘: 완전탐색import java.util.*;class Solution { public int[] solution(int[] answers) { // 1, 2, 3번 수포자가 찍는 방식을 담은 배열 int[][] pick = new int[][] { {1, 2, 3, 4, 5}, {2, 1, 2, 3, 2,..
[프로그래머스, 181893] 배열 조각하기 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/181893 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 90.9 MB, 시간: 0.03 ms사용 알고리즘: 구현import java.util.*;class Solution { public int[] solution(int[] arr, int[] query) { // arr의 시작과 끝을 가리키는 인덱스 int start = 0, end = arr.length - 1; // query를 순회하며 작업을 반복 ..
[프로그래머스, 136798] 기사단원의 무기 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/136798 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 82 MB, 시간: 12.57 ms사용 알고리즘: 구현class Solution { public int solution(int number, int limit, int power) { // 약수 개수 구하기 int[] count = new int[number + 1]; int pow; for(int i = 1; i limit) answer += power; ..
[프로그래머스, 340199] [PCCE 기출문제] 9번 / 지폐 접기 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/340199 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 76 MB, 시간: 0.04 ms사용 알고리즘: 구현class Solution { public int solution(int[] wallet, int[] bill) { int tmp; // wallet의 긴 쪽이 0 번 인덱스에 오도록 정렬 if(wallet[0]
[프로그래머스, 340211] [PCCP 기출문제] 3번 / 충돌위험 찾기 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/340211 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 125 B, 시간: 280.03 ms사용 알고리즘: 구현, 자료 구조import java.util.*;class Solution { public int solution(int[][] points, int[][] routes) { // 로봇들이 지나야 하는 경로를 담은 큐 리스트 List> ql = new ArrayList(); ArrayDeque q; int[] n..
[프로그래머스, 87946] 피로도 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/87946 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 86.3 MB, 시간: 5.28 ms사용 알고리즘: 완전탐색, 백트래킹class Solution { int[][] dungeons; boolean[] visited; int answer; public int solution(int k, int[][] dungeons) { this.dungeons = dungeons; // 해당 던전을 클리어 했는지 ..
[프로그래머스, 181841] 꼬리 문자열 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/181841 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 74.6 MB, 시간: 0.06 ms사용 알고리즘: 문자열import java.util.*;class Solution { public String solution(String[] str_list, String ex) { StringBuilder answer = new StringBuilder(); for(String str : str_list) { if(!str.conta..