본문 바로가기

카테고리

(315)
프로그래머스 - 42862번: 체육복 [Java] 문제: https://school.programmers.co.kr/learn/courses/30/lessons/42862 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 1. 코드 import java.util.*; class Solution { public int solution(int n, int[] lost, int[] reserve) { int answer = n - lost.length; boolean[] check = new boolean[n + 1]; Arrays.sort(lost); Arrays.sort(reserve); for(int l :..
프로그래머스 - 133499번: 옹알이 (2) [Java] 문제: https://school.programmers.co.kr/learn/courses/30/lessons/133499 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 1. 코드 import java.util.*; class Solution { public int solution(String[] babbling) { int answer = 0; String[] list = {"aya", "ye", "woo", "ma"}; for(String s : babbling) { StringBuilder sb = new StringBuilder(); int las..
프로그래머스 - 131128번: 숫자 짝궁 [Java] 문제: https://school.programmers.co.kr/learn/courses/30/lessons/131128 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 1. 코드 import java.util.*; class Solution { public String solution(String X, String Y) { int[] arr1 = new int[10]; int[] arr2 = new int[10]; for(String s : X.split("")) { arr1[Integer.parseInt(s)]++; } for(String s : Y...
프로그래머스 - 77484번: 로또의 최고 순위와 최저 순위 [Java] 문제: https://school.programmers.co.kr/learn/courses/30/lessons/77484 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 1. 코드 class Solution { public int[] solution(int[] lottos, int[] win_nums) { int[] answer = new int[2]; int zero = 0; int same = 0; for(int n : lottos) { if(n == 0) { zero++; continue; } for(int win : win_nums) { if(n =..
프로그래머스 - 17682번: [1차] 다트 게임 [Java] 문제: https://school.programmers.co.kr/learn/courses/30/lessons/17682 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 1. 코드 import java.util.*; class Solution { public int solution(String dartResult) { int answer = 0; Stack stack = new Stack(); String[] s1 = dartResult.split("[^0-9]+"); //문자 사이에 있는 숫자로만 구성 String[] s2 = dartResult.spli..
프로그래머스 - 136798번: 기사단원의 무기 [Java] 문제: https://school.programmers.co.kr/learn/courses/30/lessons/136798 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 1. 코드 class Solution { public int solution(int number, int limit, int power) { int answer = 0; for(int i = 1; i
프로그래머스 - 161989번: 덧칠하기 [Java] 문제: https://school.programmers.co.kr/learn/courses/30/lessons/161989 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 1. 코드 class Solution { public int solution(int n, int m, int[] section) { int answer = 0; int painted = 0; for(int start : section) { if(painted
프로그래머스 - 42889번: 실패율 [Java] 문제: https://school.programmers.co.kr/learn/courses/30/lessons/42889 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 1. 코드 import java.util.*; class Solution { public int[] solution(int N, int[] stages) { int[] answer = new int[N]; double[][] fail = new double[N][2]; int temp = stages.length; for(int i = 0; i < N; i++) { fail[i][1] = ..