https://school.programmers.co.kr/learn/courses/30/lessons/181927 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public int[] solution(int[] num_list) { int n = num_list.length; int[] answer = new int[n+1]; for(int i=0; i answer[n-2] ? answer[n-1] - answe..
https://school.programmers.co.kr/learn/courses/30/lessons/181928 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 짝수인 경우와 홀수인 경우를 나눔 StringBuilder 를 사용하여 문자열을 저장하고 toString() 으로 전환 Integer.parseInt() 를 사용하여 정수로 바꿔주고 마지막에 짝수값 + 홀수값 class Solution { public int solution(int[] num_list) { StringBuilder evenSb = new StringBuilder(); String..
https://school.programmers.co.kr/learn/courses/30/lessons/181929 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public int solution(int[] num_list) { int answer = 0; int sum = 0; int mul = 1; for(int i=0; i
class Solution { public int solution(int a, int b, int c) { int answer = 0; int answer1 = a+b+c; int answer2 = (a*a + b*b + c*c); int answer3 = (a*a*a + b*b*b + c*c*c); if(a==b) { if(b==c){ answer = answer1 * answer2 * answer3; } else { answer = answer1 * answer2; } } else if (b==c) { if(a==c) { answer = answer1 * answer2 * answer3; } else { answer = answer1 * answer2; } } else if(a==c){ if(a==b..
https://school.programmers.co.kr/learn/courses/30/lessons/181932 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public String solution(String code) { String answer = ""; boolean mode = false; StringBuilder ret = new StringBuilder(); for(int i=0; i
![article thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fc7xNTq%2FbtsbjhLwyKk%2FK00MvnsmOizqk0EGJd6vNK%2Fimg.png)
class Solution { public int[] solution(int money) { int[] answer = new int[2]; int icedCoffee = 5500; answer[0] = money/icedCoffee; answer[1] = money%icedCoffee; return answer; } }
![article thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FouVwc%2Fbtsbk2tIPrG%2FV4qCasOsOFfRIJo5nx6Ck0%2Fimg.png)
피자 조각이 7개 ! 사람이 7 명일 때는 1판 필요하고, 14판일 때는 2판 ... 8 명일 때는 2판이 필요하다. n이 7의 배수일 때는 n / 7 , 아닐 때는 ( n / 7 ) + 1 이 된다. 나머지 연산자를 이용 class Solution { public int solution(int n) { int answer = 0; if ( n % 7 == 0 ) { answer = n / 7 ; }else { answer = ( n / 7 ) + 1; } return answer; } }