2025/04/24 5

[프로그래머스: 완전탐색] 소수 찾기

https://school.programmers.co.kr/learn/courses/30/lessons/42839 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr # 코드import java.util.*;class Solution { Set set = new HashSet(); // 중복없이 저장하기 위한 set public int solution(String numbers) { permutation("", numbers); // 모든 숫자 조합을 만들어 set에 저장 int answer = 0; for (int num : set) {..

[프로그래머스: 완전탐색] 모의고사

https://school.programmers.co.kr/learn/courses/30/lessons/42840 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr # 코드import java.util.*;class Solution { public int[] solution(int[] answers) { int[] pattern1 = {1, 2, 3, 4, 5}; int[] pattern2 = {2, 1, 2, 3, 2, 4, 2, 5}; int[] pattern3 = {3, 3, 1, 1, 2, 2, 4, 4, 5, 5}; int[] score = ..

[프로그래머스: 완전탐색] 최소직사각형

https://school.programmers.co.kr/learn/courses/30/lessons/86491 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr # 초기 코드class Solution { public int solution(int[][] sizes) { int max_w = 0; int max_h = 0; for (int[] card : sizes) { // 세로 길이가 더 길면 눕힘 if (card[0] 카드 하나하나 눕히는 딩초코드 ┌( ´_ゝ` )┐ # ✨ 프로그래머스 1등 코드 ✨..

[프로그래머스: 해시] 완주하지 못한 선수

https://school.programmers.co.kr/learn/courses/30/lessons/42576 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr # sort()를 이용한 코드import java.util.*;class Solution { public String solution(String[] participant, String[] completion) { Arrays.sort(participant); Arrays.sort(completion); for (int i = 0; i 시간복잡도 : O(n log n) # HashMa..

[프로그래머스: BFS] 단어 변환

https://school.programmers.co.kr/learn/courses/30/lessons/43163 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr # BFS 코드import java.util.*;class Solution { List visited; // 방문 여부 체크 리스트 (방문한 단어를 저장) public int solution(String begin, String target, String[] words) { visited = new ArrayList(); // 방문 리스트 초기화 return bfs(begin, target, ..