목록프로그래머스 (93)
csct3434
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public String solution(int n, int t, int m, int p) { int num = 0, order = 1; StringBuilder answer = new StringBuilder(); if (m == p) { p = 0; } while (answer.length() != t) { String converted = Integer.toString(num++, n); for (char c : converted.toCharArray()) { i..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.Arrays; class Solution { public String[] solution(String[] files) { Arrays.sort(files, (str1, str2) -> { String head1 = parseHead(str1.toLowerCase()); String head2 = parseHead(str2.toLowerCase()); if (head1.compareTo(head2) == 0) { Integer number1 = parseNumber(st..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.ArrayList; import java.util.HashMap; class Solution { public int[] solution(String msg) { ArrayList answer = new ArrayList(); HashMap dict = new HashMap(); for (char c = 'A'; c
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.Stack; class Solution { public int solution(int cacheSize, String[] cities) { if (cacheSize == 0) { return 5 * cities.length; } int answer = 0; Stack stack = new Stack(); for (String city : cities) { city = city.toLowerCase(); int index = stack.search(city); if (i..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public int solution(int m, int n, String[] b) { char[][] board = new char[m][n]; for (int i = 0; i < m; i++) { board[i] = b[i].toCharArray(); } return solve(m, n, board); } public int solve(int m, int n, char[][] board) { int count = 0; boolean[][] mark = new bool..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.HashMap; import java.util.HashSet; import java.util.Map; class Solution { public int solution(String str1, String str2) { HashMap tokenMap1 = new HashMap(); HashMap tokenMap2 = new HashMap(); extractTokens(str1.toLowerCase(), tokenMap1); extractTokens(str2.toLower..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public int solution(int n, int a, int b) { int answer = 0; while (true) { answer++; a = (a + 1) / 2; b = (b + 1) / 2; if (a == b) { break; } } return answer; } }
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public int[] solution(int n, String[] words) { HashSet usedWords = new HashSet(); char lastCharacter = words[0].charAt(0); for (int i = 0; i < words.length; i++) { String word = words[i]; if (usedWords.contains(word) || word.charAt(0) != lastCharacter) { return ne..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr public class Solution { public int solution(int n) { if (n
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public int solution(int N, int[][] road, int K) { List graph = new ArrayList(); int[] distance = new int[N + 1]; init(graph, distance, road, N); PriorityQueue pq = new PriorityQueue(Comparator.comparingInt(a -> a[1])); pq.add(new int[]{1, 0}); while (!pq.isEmpty()..