목록전체 글 (130)
csct3434
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.Arrays; import java.util.HashSet; import java.util.Map; import java.util.stream.Collectors; class Solution { public int solution(int[] toppings) { int answer = 0; Map partA = Arrays.stream(toppings).boxed() .collect(Collectors.groupingBy(t -> t, Collectors.countin..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.stream.Collectors; class Solution { public int solution(int k, int[] tangerine) { int answer = 0; Map countBySize = Arrays.stream(tangerine).boxed() .collect(Collec..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.Map; import java.util.Queue; class Solution { private Map countsPerSector = new HashMap(); private int[][] sectorInfo; private boolean[][] visited; public int solution(int[][] land) {..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.Arrays; import java.util.Comparator; class Solution { public int solution(int[][] targets) { int answer = 0; Arrays.sort(targets, Comparator.comparingInt(target -> target[1])); answer++; int lastPos = targets[0][1]; for (int i = 1; i < targets.length; i++) { int s..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.Arrays; import java.util.Comparator; import java.util.Stack; class Solution { public String[] solution(String[][] plans) { String[] answer = new String[plans.length]; int index = 0; for (String[] plan : plans) { String[] split = plan[1].split(":"); int minutes = I..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { private int subscribe = 0; private int purchase = 0; private static int[] rate = {10, 20, 30, 40}; public int[] solution(int[][] users, int[] emoticons) { func(users, emoticons, new int[emoticons.length], 0); return new int[]{subscribe, purchase}; } private void f..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public int solution(int storey) { int answer = 0; while (storey > 0) { int n = storey % 10; if (n < 5 || (n == 5 && storey % 100 < 50)) { answer += n; } else { answer += 10 - n; storey += 10; } storey /= 10; } return answer; } }
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.Arrays; import java.util.LinkedList; import java.util.List; class Solution { public int solution(int[] arrayA, int[] arrayB) { Arrays.sort(arrayA); Arrays.sort(arrayB); List aDivs = getDivisiors(arrayA[0]); List bDivs = getDivisiors(arrayB[0]); int aOfArrayA = cal..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.LinkedList; import java.util.List; class Solution { public double[] solution(int k, int[][] ranges) { double[] answer = new double[ranges.length]; List sequences = calcSequences(k); for (int i = 0; i < ranges.length; i++) { answer[i] = getArea(sequences, ranges[i]..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.HashMap; import java.util.Map; class Solution { public int solution(String[] want, int[] number, String[] discount) { int answer = 0; Map wantsCount = new HashMap(); for (int i = 0; i < want.length; i++) { wantsCount.put(want[i], number[i]); } HashMap discountsCou..