전체 글

전체 글

    [프로그래머스, 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,..

    [백준, BOJ 1051] 숫자 정사각형 (java)

    https://www.acmicpc.net/problem/1051메모리: 14,252 KB , 시간: 104 ms사용 알고리즘: 브루트포스 알고리즘, 구현 import java.io.BufferedReader;import java.io.InputStreamReader;import java.util.StringTokenizer;public class Main { public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.rea..

    [프로그래머스, 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..

    [프로그래머스, 159994] 카드 뭉치 (java)

    https://school.programmers.co.kr/learn/courses/30/lessons/159994 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 81.3 MB, 시간: 0.04 ms사용 알고리즘: 구현class Solution { public String solution(String[] cards1, String[] cards2, String[] goal) { // 카드 뭉치를 가리키는 인덱스 int idx1 = 0, idx2 = 0; for(int i = 0; i