Algorithm (PS)/프로그래머스44 [프로그래머스 Level 1] 예산 (Java) 문제 https://school.programmers.co.kr/learn/courses/30/lessons/12982 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 풀이 import java.util.*; class Solution { public int solution(int[] d, int budget) { int answer = 0; Arrays.sort(d); for(int i=0; i=0){ answer++; budget -=d[i]; }else{ break; } } return answer; } } 2023. 8. 24. [프로그래머스 Level 1] 최대공약수와 최소공배수 [Java] 문제 https://school.programmers.co.kr/learn/courses/30/lessons/12940 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 코드 class Solution { public int[] solution(int n, int m) { int[] answer = new int[2]; int min = Math.min(n,m); int max = 0; for(int i=1; i 2023. 8. 20. [프로그래머스 Level 1] 직사각형 별찍기 [Java] 문제 https://school.programmers.co.kr/learn/courses/30/lessons/12969 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 코드 import java.util.Scanner; class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); StringBuilder sb = new StringBuilder(); for(int i=0; i 2023. 8. 20. [프로그래머스 Level 1] 행렬의 덧셈 [Java] 문제 https://school.programmers.co.kr/learn/courses/30/lessons/12950 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 코드 class Solution { public int[][] solution(int[][] arr1, int[][] arr2) { int[][] answer = new int[arr1.length][arr1[0].length]; for(int i=0; i 2023. 8. 20. [프로그래머스 Level 1] 문자열 다루기 기본 [Java] 문제 https://school.programmers.co.kr/learn/courses/30/lessons/12918 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 코드 class Solution { public boolean solution(String s) { if(!(s.length()==4 || s.length()==6)) return false; for(int i=0; i 2023. 8. 20. [프로그래머스 Level 1] 부족한 금액 계산하기 [Java] 문제 https://school.programmers.co.kr/learn/courses/30/lessons/82612 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 코드 class Solution { public long solution(int price, int money, int count) { long answer = -1; long needPrice=0; for(int i=1; imoney){ answer = needPrice - money; }else{ answer = 0; } return answer; } } 2023. 8. 20. 이전 1 2 3 4 5 6 ··· 8 다음