https://school.programmers.co.kr/learn/courses/30/lessons/120808 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 나의 풀이 class Solution { public int[] solution(int numer1, int denom1, int numer2, int denom2) { int[] answer; int bottom = denom1 * denom2; int top = (numer1 * denom2) + (numer2 * denom1); int n = gcd(top, bottom); answer =..
https://school.programmers.co.kr/learn/courses/30/lessons/120907 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 나의 풀이 import java.util.ArrayList; import java.util.Arrays; import java.util.List; class Solution { public String[] solution(String[] quiz) { List list = new ArrayList(); for (String q : quiz) { String[] mod = q.split(" ");..
https://school.programmers.co.kr/learn/courses/30/lessons/120812 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 나의 풀이 class Solution { public int solution(int[] array) { int answer = 0; int maxCnt = 0; int[] cnt = new int[1001]; for (int num : array) { cnt[num]++; if (maxCnt < cnt[num]) { maxCnt = cnt[num]; answer = num; } } int res..
https://school.programmers.co.kr/learn/courses/30/lessons/120863 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 나의 풀이 class Solution { public String solution(String polynomial) { String answer; int coe = 0; int con = 0; String[] degree = polynomial.split(" \\+ "); for (String d : degree) { if (d.equals("x")) coe++; else if (d.contai..
https://school.programmers.co.kr/learn/courses/30/lessons/120921 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 나의 풀이 class Solution { public int solution(String A, String B) { int answer = 0; if (A.equals(B)) return answer; for (int i = 1; i < A.length(); i++) { A = A.charAt(A.length()-1) + A.substring(0, A.length()-1); answer++; i..
https://school.programmers.co.kr/learn/courses/30/lessons/120880 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 나의 풀이 class Solution { public int[] solution(int[] numlist, int n) { return Arrays.stream(numlist) .boxed() .sorted((a, b) -> Math.abs(a - n) == Math.abs(b - n) ? b.compareTo(a) : Integer.compare(Math.abs(a - n), Math.abs(..
https://school.programmers.co.kr/learn/courses/30/lessons/120871 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 나의 풀이 class Solution { public int solution(int n) { int answer = n; int i = 1; while (i
https://school.programmers.co.kr/learn/courses/30/lessons/120878 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 나의 풀이 class Solution { public int solution(int a, int b) { int den = b / gcd(a, b); while (den != 1) { if (den % 2 == 0) { den /= 2; } else if (den % 5 == 0) { den /= 5; } else { return 2; } } return 1; } private int gcd(i..
https://school.programmers.co.kr/learn/courses/30/lessons/120882 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 나의 풀이 import java.util.ArrayList; import java.util.Comparator; import java.util.List; class Solution { public int[] solution(int[][] score) { List scoreList = new ArrayList(); for(int[] s : score){ scoreList.add(s[0] + s[1..
https://school.programmers.co.kr/learn/courses/30/lessons/120884 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 나의 풀이 class Solution { public int solution(int chicken) { int answer = 0; while (chicken > 9) { answer += chicken / 10; chicken = chicken / 10 + chicken % 10; } return answer; } } 다른 풀이 class Solution { public int solution..