https://school.programmers.co.kr/learn/courses/30/lessons/42885 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.*; class Solution { public int solution(int[] people, int limit) { int answer = 0; //한 번에 최대 2명!! //크기 순으로(큰거~작은거) Arrays.sort(people); Deque deque = new ArrayDeque(); for(int i=0;i
https://school.programmers.co.kr/learn/courses/30/lessons/42842 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public int[] solution(int brown, int yellow) { //가로>=세로 길이 고정!!! int[] answer = new int[2]; //가로, 세로 int s=brown+ yellow;//전체 넓이, 즉 a*b int k=(int)Math.floor(Math.sqrt(s)); //2a+2b-4 = brown int a=s,b; whil..
https://school.programmers.co.kr/learn/courses/30/lessons/70129 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public int[] solution(String s) { int[] answer = new int[2]; //이진변환수, 제거된 0 수 while(!s.equals("1")) { answer[0]++; int temp=s.replaceAll("0", "").length(); answer[1]+=s.length()-temp; s=Integer.toString(tem..
https://school.programmers.co.kr/learn/courses/30/lessons/12922 사실상 푸는 의미가 거의 없는 문제긴 함.... class Solution { public String solution(int n) { String answer = ""; for(int i=1;i
https://school.programmers.co.kr/learn/courses/30/lessons/42576?language=java 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.Arrays; class Solution { public String solution(String[] participant, String[] completion) { Arrays.sort(participant); Arrays.sort(completion); for(int i=0;i
https://school.programmers.co.kr/learn/courses/30/lessons/12939 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public String solution(String s) { String[] temp=s.split(" "); int[] mm = new int[2]; //min, max for(int i=0;ix) mm[0]=x; else if(mm[1]
https://school.programmers.co.kr/learn/courses/30/lessons/12943 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 테스트케이스 3번에서 계속 답이 다르게 나와서(-1이라고 나와야되는데 488번만에 통과된걸로 뜸) 찾아봤더니 num이 int형이라 연산을 계속하다보니 오버플로우돼서 그렇다고 한다! 그래서 long으로 바꾼 변수로 진행했더니 잘 돌아가더라.. class Solution { public int solution(int num) { int answer = 0; long x=(long)num; while(..
https://school.programmers.co.kr/learn/courses/30/lessons/42840 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 마지막에 리턴할 때 list에 있는 값을 일일히 int[] 형의 answer에 저장하여 반환하는 것이 아닌, list를 array로 변환하며 바로 return하고 싶었다. List 클래스의 toArray함수를 정확히 알기 위해 다음의 블로그들을 참고하였다. http://asuraiv.blogspot.com/2015/06/java-list-toarray.html https://hianna.tisto..