목록알고리즘 (60)
개발자는 기록이 답이다

https://school.programmers.co.kr/learn/courses/30/lessons/42840 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.*; public class Solution { public int[] solution(int[] answers) { int[] first = {1,2,3,4,5}; // 5개씩 반복 int[] second = {2,1,2,3,2,4,2,5}; // 8개씩 반복 int[] third = {3,3,1,1,2,2,4,4,5,5}; // 10개씩 반복 int answer1..

https://school.programmers.co.kr/learn/courses/30/lessons/86491 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 사고력의 문제이다. 문제에서 설명하는 것처럼 최대값을 찾아서 분기처리로 가로 세로 바꿔주려고 했으면 엄청 오래 걸릴 것 같다 가로, 세로의 최대값, 최소값을 구하고 그 최대값과 최소값의 최대값을 구하면 빠르게 풀린다. public class Solution { public int solution(int[][] sizes) { int hMax = Integer.MIN_VALUE; // 수평 int ..

https://school.programmers.co.kr/learn/courses/30/lessons/42748 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 내가 푼 풀이 import java.util.*; class Solution { public int[] solution(int[] array, int[][] commands) { int[] answer = new int[commands.length]; for (int a = 0; a < commands.length; a++) { int i = commands[a][0]; // 2 int j = c..

https://school.programmers.co.kr/learn/courses/30/lessons/42586 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 내가 푼 풀이 poll를 while문 들어가기 전에 먼저 하고, 분기처리할때마다 poll했다. 남아있는 cnt를 추가했다. import java.util.*; public class Solution { public int[] solution(int[] progresses, int[] speeds) { Queue Q = new LinkedList(); for (int i = 0; i < progre..