JadenCase 문자열 만들기 사용 알고리즘: ??사용 언어: java import java.util.*;class Solution { public String solution(String s) { s = s.toLowerCase(); boolean first = true; String answer = ""; for(int i = 0; i 공백 문자가 2개 이상 연속으로 나올 수 있다.. 알고리즘/프로그래머스 2025.07.13
카드 뭉치 사용 알고리즘:사용 언어: java import java.util.*;class Solution { String a = "No"; public String solution(String[] cards11, String[] cards22, String[] goall) { //String answer = ""; List cards1 = new ArrayList(); List cards2 = new ArrayList(); List goal = new ArrayList(); for(String c : cards11) { cards1.add(c); } for(String c :.. 알고리즘/프로그래머스 2025.07.12
구명보트 사용 알고리즘: 그리디사용 언어: java import java.util.*;class Solution { public int solution(int[] people, int limit) { int left = 0; int right = people.length - 1; int answer = 0; Arrays.sort(people); while(left = right && people[left] != -1) { System.out.println(Arrays.toString(people)); answer++; } } .. 알고리즘/프로그래머스 2025.07.11
카펫 사용 알고리즘: 완전탐색사용 언어: java import java.util.*;class Solution { public int[] solution(int brown, int yellow) { int[] answer = new int[] {-1, -1}; //카펫가로, 카펫세로 for(int A = 1; A 으엥... 함수 안에서 answer = new int[] {B_, A_ }; 로 하니까 answer 값이 변하지 않았다 알고리즘/프로그래머스 2025.07.11
롤케이크 자르기 사용 알고리즘: 해시사용 언어: java import java.util.*;class Solution { public int solution(int[] topping) { Map map1 = new HashMap(); Map map2 = new HashMap(); ///map1.put(topping[0], 1); for(int i=0; i 설마 이건가 했는데 이거네.. 알고리즘/프로그래머스 2025.07.11
짝지어 제거하기 사용 알고리즘: 스택사용 언어: java import java.util.*;class Solution{ public int solution(String s) { Stack stk = new Stack(); for(int i=0; i 아 스택은.................스택 문제는 아이디어가 잘 떠오르지 않는다ㅠ 알고리즘/프로그래머스 2025.07.10
요격 시스템 사용 알고리즘: 그리디??사용 언어: java import java.util.*;class Solution { public int solution(int[][] targets) { Arrays.sort(targets, (a, b) -> { if(a[1] == b[1]) return b[0] - a[0]; return a[1] - b[1]; }); //for(int[] t : targets) { // System.out.println(Arrays.toString(t)); //} int answer = 0; int last = -1; for(in.. 알고리즘/프로그래머스 2025.07.08
실패율 사용 알고리즘: ...사용 언어: java import java.util.*;class Solution { List list = new ArrayList(); public int[] solution(int N, int[] stages) { Arrays.sort(stages); int[][] arr = new int[N + 1][3]; for(int i = 1; i { // if(a[1] == b[1]) return a[0] - b[0]; // return b[1] - a[1]; //}); //흑흑 list.sort((a, b) -> Double.compare(b[1], a[1.. 알고리즘/프로그래머스 2025.07.07
[PCCE 기출문제] 10번 / 데이터 분석 사용 알고리즘: ..사용 언어: java import java.util.*;class Solution { public int[][] solution(int[][] data, String ext, int val_ext, String sort_by) { //데이터 뽑고 int standIdx = checkIdx(ext); int sortIdx = checkIdx(sort_by); List list = extractData(data, standIdx, val_ext); //오름차순 Collections.sort(list, (a, b) -> a[sortIdx] - b[sortIdx]); int[][] answer = n.. 알고리즘/프로그래머스 2025.07.07
[PCCE 기출문제] 10번 / 공원 사용 알고리즘: 완전탐색사용 언어: java import java.util.*;class Solution { public int solution(int[] mats, String[][] park) { Arrays.sort(mats); return carpet(mats, park); } public int carpet(int[] mats, String[][] park) { int answer = -1; for(int size = mats.length - 1; size >= 0 ; size--) { if(park.length 알고리즘/프로그래머스 2025.07.07