분류 전체보기 795

프로그래머스 개미 군단 (JAVA)

https://school.programmers.co.kr/learn/courses/30/lessons/120837 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { private static final int[] DAMAGE = {5,3,1}; private static final int INF = 987654321; public int solution(int hp) { int[][] dp = new int[hp+1][3]; int answer = cal(0,hp,dp); return answer; } private int c..

알고리즘 2022.12.12

프로그래머스 이진수 더하기 (JAVA)

https://school.programmers.co.kr/learn/courses/30/lessons/120885 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public String solution(String bin1, String bin2) { String answer = ""; int num1 = changeDec(bin1); System.out.println(num1); int num2 = changeDec(bin2); System.out.println(num2); answer = changeBin(num1+nu..

알고리즘 2022.12.11

프로그래머스 종이 자르기 (JAVA)

https://school.programmers.co.kr/learn/courses/30/lessons/120922 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public int solution(int M, int N) { int answer = 0; int temp = N - 1; answer += temp + N * (M-1); return answer; } }

알고리즘 2022.12.09

프로그래머스 가장 큰 수 찾기 (JAVA)

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

알고리즘 2022.12.08

프로그래머스 옷가게 할인 받기 (JAVA)

https://school.programmers.co.kr/learn/courses/30/lessons/120818 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { private static final int[] PRICE = {100_000, 300_000, 500_000}; private static final int[] SALE = {95, 90, 80}; public int solution(int price) { int answer = price; for(int i = 2 ; i >= 0 ; i--){ if(price ..

알고리즘 2022.12.05

프로그래머스 모음 제거 (JAVA)

https://school.programmers.co.kr/learn/courses/30/lessons/120849 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { private static final char[] collections = {'a','e','i','o','u'}; public String solution(String my_string) { String answer = ""; StringBuilder sb = new StringBuilder(); for(int i = 0 ; i < my_string.length(..

알고리즘 2022.12.04

프로그래머스 중앙값 구하기 (JAVA)

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

알고리즘 2022.12.03

프로그래머스 순서쌍의 개수 (JAVA)

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

알고리즘 2022.12.02