목록프로그래머스 (93)
csct3434
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. 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..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.stream.IntStream; class Solution { private int answer = 0; public int solution(int k, int[][] dungeons) { int total = dungeons.length; boolean[] visited = new boolean[total]; solve(total, 0, 0, visited, dungeons, k); return answer; } private void solve(int total, ..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public int[] solution(int n, long left, long right) { int[] answer = new int[(int) (right - left + 1)]; int count = 0; for (long num = left; num = base) { answer[count] += (int) (rem - base + 1); } } return answer; } }
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public int solution(int n, int[][] wires) { int answer = n; int[] count = new int[n + 1]; boolean[] visited = new boolean[n + 1]; boolean[][] adjacentMatrix = new boolean[n + 1][n + 1]; initAdjacentMatrix(adjacentMatrix, wires); dfs(n, 1, count, visited, adjacentM..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.LinkedList; import java.util.List; class Solution { public int solution(String word) { List dictionary = new LinkedList(); initDictionary("", 0, dictionary); return dictionary.indexOf(word) + 1; } private void initDictionary(String word, int depth, List dictionary..