목록전체 글 (130)
csct3434
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.Arrays; class Solution { public int solution(int[] people, int limit) { int answer = 0; Arrays.sort(people); int light = 0, heavy = people.length - 1; while (light < heavy) { if(people[light]
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public String solution(String number, int k) { int index = 0; int count = 0; StringBuilder stringBuilder = new StringBuilder(number); while (count < k && index + 1 < stringBuilder.length()) { if (stringBuilder.charAt(index) < stringBuilder.charAt(index + 1)) { str..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { private int answer = Integer.MAX_VALUE; public int solution(String name) { solve(name, "A".repeat(name.length()), 0, 0); return answer; } private void solve(String correctName, String currentName, int pos, int count) { count += Math.min(Math.abs(correctName.charAt..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public int[] solution(int brown, int yellow) { int total = brown + yellow; for (int i = 3; i * i
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.HashSet; import java.util.Set; class Solution { private Set answer = new HashSet(); public int solution(String numbers) { boolean[] visited = new boolean[numbers.length()]; int[] selected = new int[numbers.length()]; for (int count = 1; count
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.Arrays; class Solution { public int solution(int[] citations) { int answer = 0; int total = citations.length; Arrays.sort(citations); int index = 0; for (int h = 0; h
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.Arrays; class Solution { public String solution(int[] numbers) { String answer = Arrays.stream(numbers) .mapToObj(String::valueOf) .sorted((a, b) -> (b + a).compareTo(a + b)) .reduce("", (a, b) -> a + b); return answer.equals("0".repeat(answer.length())) ? "0" : a..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.PriorityQueue; class Solution { public int solution(int[] scoville, int K) { int answer = 0; PriorityQueue pq = new PriorityQueue(); for (int scv : scoville) { pq.add(1L * scv); } while (pq.size() > 1) { if (pq.peek() >= K) { return answer; } Long scv1 = pq.poll()..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public int solution(int[] priorities, int location) { int answer = 0; PriorityQueue pq = new PriorityQueue(Comparator.comparing(m -> -m)); Queue queue = new LinkedList(); for (int i = 0; i < priorities.length; i++) { queue.add(i); pq.add(priorities[i]); } while (q..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public int[] solution(int[] progresses, int[] speeds) { ArrayList answer = new ArrayList(); int[] finishTime = new int[progresses.length]; for (int i = 0; i < progresses.length; i++) { finishTime[i] = (int) Math.ceil((100D - progresses[i]) / speeds[i]); } for (int..