알고리즘 778

프로그래머스 풍선 터트리기 (JAVA)

https://school.programmers.co.kr/learn/courses/30/lessons/68646 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { private static final int MAX_VALUE = 1_000_000_000; public int solution(int[] a) { int answer = 0; int size = a.length; int[] leftMin = new int[size]; int[] rightMin = new int[size]; int min = MAX_VALUE; fo..

알고리즘 2023.04.10

프로그래머스 마법의 엘리베이터(JAVA)

https://school.programmers.co.kr/learn/courses/30/lessons/148653 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.*; class Solution { public int solution(int storey) { int answer = cal(storey); return answer; } private static int cal(int storey){ int num = storey; int result = 0; while(num > 0){ int temp = num % 10; i..

알고리즘 2023.04.08

프로그래머스 퍼즐 조각 채우기 (JAVA)

https://school.programmers.co.kr/learn/courses/30/lessons/84021 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.*; class Solution { public int solution(int[][] game_board, int[][] table) { int answer = 0; List list = find(table,POINT); boolean[] used = new boolean[list.size()]; List emptys = find(game_board,EMPTY); f..

알고리즘 2023.04.07

백준 24885번 주식 (JAVA)

https://www.acmicpc.net/problem/24885 24885번: 주식 첫째 줄에 과거에 머무를 수 있는 기간 $N(2\le N \le 10)$, 숭고한이 가지고 간 돈 $M(0 \le M \le 1\,000)$, 대출할 수 있는 한도 $K(1 \le K \le 4)$가 공백으로 구분되어 주어진다. 둘째 줄에 과거로 돌아간 www.acmicpc.net package BOJ.simulation; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.function.Function; public class BOJ_24885 { public ..

알고리즘 2023.04.06

백준 5566번 주사위 게임 (JAVA)

https://www.acmicpc.net/problem/5566 5566번: 주사위 게임 상근이는 혼자 보드 게임을 하고 있다. 이 보드 게임의 보드는 N칸으로 이루어져 있고, 출발점은 1칸, 도착점은 N칸이다. 각 칸에는 지시 사항이 적혀있다. 지시 사항은 말을 얼만큼 이동해야 하 www.acmicpc.net package BOJ.simulation; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.function.Function; public class BOJ_5566 { public static void main(String[] args) ..

알고리즘 2023.04.05

프로그래머스 호텔 대실 (JAVA)

https://school.programmers.co.kr/learn/courses/30/lessons/155651 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.*; class Solution { private static class Reservation{ int startTime; int endTime; public Reservation(int startTime, int endTime){ this.startTime = startTime; this.endTime = endTime; } } public int solution..

알고리즘 2023.04.04

프로그래머스 과제 진행하기 (JAVA)

https://school.programmers.co.kr/learn/courses/30/lessons/176962 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.*; class Solution { private static class Work{ String name; int workingTime; public Work(String name, int workingTime){ this.name = name; this.workingTime = workingTime; } } public String[] solution(String..

알고리즘 2023.04.03

프로그래머스 표현 가능한 이진트리 (JAVA)

https://school.programmers.co.kr/learn/courses/30/lessons/150367 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public int[] solution(long[] numbers) { int[] answer = new int[numbers.length]; for(int i = 0 ; i < numbers.length ; i++){ String str = numToBinary(numbers[i]); if(checkBinaryTree(0,str.length()-1,str) == ..

알고리즘 2023.04.02

프로그래머스 택배 배달과 수거하기(JAVA)

https://school.programmers.co.kr/learn/courses/30/lessons/150369 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public long solution(int cap, int n, int[] deliveries, int[] pickups) { long answer = 0; int delIndex = -1; int pickIndex = -1; for(int i = 0 ; i 0) { delIndex = i; } if(pick..

알고리즘 2023.04.01