Java 60

[백준] 2293 : 동전1, 2625 : 동전 바꿔주기

- 동전 개수에 제한이 없는 경우 더보기import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;public class Main { static int N; // 지폐의 금액 static int K; // 동전의 가지수 // 동전의 금액 pi와 개수 ni static int[] pi; static int[] ni; static int res; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); N = Integer..

[프로그래머스] 튜플

문제 https://school.programmers.co.kr/learn/courses/30/lessons/64065 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr  입출력  아이디어- 앞 뒤 {{ }} 제거 - 정규 표현식 작성- 이미 앞에서 있던 값은 제외    코드  import java.util.*;class Solution { public int[] solution(String s) { s = s.substring(2, s.length() - 2); // 앞 "{{", 뒤 "}}" 제거 String[] groups = s.split("\\},\\{"); // "..

Java 2025.04.12

[프로그래머스] 호텔 대실

문제https://school.programmers.co.kr/learn/courses/30/lessons/155651 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr   입출력  아이디어 - 시간 (String) 비교할 때 분으로 바꿔서 계산하기 !- PriorityQueue 사용 (그리디) 생각해보면 가장 짧은 시간 먼저 찾으면 됨  코드  import java.util.*;class Solution { public int solution(String[][] book_time) { int answer = 0; Arrays.sort(book_time, ..

Java 2025.04.12

[프로그래머스] 숫자 변환하기

문제https://school.programmers.co.kr/learn/courses/30/lessons/154538 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr   코드  import java.util.*;class Solution { public int solution(int x, int y, int n) { Queue queue = new LinkedList(); boolean[] visited = new boolean[y + 1]; // 0~y 까지 queue.add(new int[]{y, 0}); visited[y] = true; ..

[프로그래머스] 주식가격

문제 https://school.programmers.co.kr/learn/courses/30/lessons/42584 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr  입출력prices [ 1, 2, 3, 2, 3]return [4, 3, 1, 1, 0]   아이디어초 단위로 기록된 주식가격이 담긴 배열 prices가 매개변수로 주어질 때, 가격이 떨어지지 않은 기간은 몇 초인지를 return 하도록 solution 함수를 완성하세요.  코드  import java.util.*;class Solution { static int N; public int[] solution(int[] price..

[프로그래머스] 후보키

문제 https://school.programmers.co.kr/learn/courses/30/lessons/42890 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr     코드  import java.io.*;import java.util.*;class Solution { public int solution(String[][] relation) { int answer = 0; int N = relation.length; int M = relation[0].length; List keys = new ArrayList(); for(int..

Java 2025.04.03

[프로그래머스] 뒤에 있는 큰 수 찾기

문제 https://school.programmers.co.kr/learn/courses/30/lessons/154539 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr  아이디어 stack 에 자신보다 큰 수만 남겨두기   코드  import java.io.*;import java.util.*;class Solution { public int[] solution(int[] numbers) { int[] answer = new int[numbers.length]; Arrays.fill(answer, -1); Stack stack = new Stack(); ..

Java 2025.04.02