목록프로그래머스 (93)
csct3434
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.LinkedList; class Solution { public int solution(String s) { int answer = s.length(); for (int len = 1; len 1) { result.append(count); } result.append(token); } answer = Math.min(answer, result.length()); } return answer; } }
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.HashSet; import java.util.Objects; class Solution { public int solution(String dirs) { Position position = new Position(0, 0); HashSet paths = new HashSet(); for (char direction : dirs.toCharArray()) { Position nextPosition = position.goTo(direction); if (position..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.HashMap; class Solution { public int solution(String skill, String[] skill_trees) { int answer = 0; HashMap priorityMap = new HashMap(); for (int i = 0; i < skill.length(); i++) { priorityMap.put(skill.charAt(i), i); } for (String skillTree : skill_trees) { int la..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public int solution(int[] numbers, int target) { int answer = 0; int len = numbers.length; int total = 1
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.HashSet; import java.util.LinkedList; class Solution { public int solution(String[][] relation) { int rows = relation.length; int cols = relation[0].length; LinkedList superKeys = new LinkedList(); for (int mask = 1; mask < (1
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.HashMap; import java.util.LinkedList; class Solution { public String[] solution(String[] record) { LinkedList answer = new LinkedList(); HashMap nickname = new HashMap(); for (String r : record) { String[] token = r.split(" "); if (!token[0].equals("Leave")) { nic..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. 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..