프로그래머스
[프로그래머스, 140108] 문자열 나누기 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/140108 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 77.2 MB, 시간: 8.21 ms사용 알고리즘: 문자열class Solution { public int solution(String s) { int answer = 0; int cnt1 = 0, cnt2 = 0; char x = 'A'; for(int i = 0; i
[프로그래머스, 181847] 0 떼기 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/181847 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 90.1 MB, 시간: 0.02 ms사용 알고리즘: 문자열class Solution { public String solution(String n_str) { int start = 0; for(int i = 0; i
[프로그래머스, 161990] 바탕화면 정리 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/161990 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 81.6 MB, 시간: 0.19 ms사용 알고리즘: 구현class Solution { public int[] solution(String[] wallpaper) { // 바탕화면 정보 int N = wallpaper.length; int M = wallpaper[0].length(); int[] answer = new int[] {-1, -1, -1, ..
[프로그래머스, 172928] 공원 산책 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/172928 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 92.6 MB, 시간: 0.20 ms사용 알고리즘: 구현class Solution { String[] park; int N, M; public int[] solution(String[] park, String[] routes) { // 공원 정보 this.park = park; N = park.length; M = park[0].length(..
[프로그래머스, 131704] 택배상자 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/131704 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr 메모리: 79.4 MB, 시간: 1.45 ms사용 알고리즘: 자료구조, 스택import java.util.*;class Solution { public int solution(int[] order) { int answer = 0; int pointer = 1; // 컨테이너 벨트의 가장 앞에 있는 택배 번호 Deque deq = new ArrayDeque(); // 보조 ..
[프로그래머스, 49993] 스킬트리 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/49993 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 87.5 MB, 시간: 0.04 ms사용 알고리즘: 위상정렬class Solution { public int solution(String skill, String[] skill_trees) { // skill의 길이가 1이면 모든 경우가 가능 if(skill.length() == 1) return skill_trees.length; // 위상정렬 int[..
[프로그래머스, 42748] K번째수 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/42748 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 79.4 MB, 시간: 1.45 ms사용 알고리즘: 정렬import java.util.*;class Solution { public int[] solution(int[] array, int[][] commands) { int[] answer = new int[commands.length]; int[] tmp; int len; for(int i = 0; i
[프로그래머스, 92341] 주차 요금 계산 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/92341 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 75.7 MB, 시간: 9.33 ms사용 알고리즘: 자료구조import java.util.*;class Solution { static int[] fees; public int[] solution(int[] fees, String[] records) { this.fees = fees; // 주차 중인 차량과 입차 시간을 담은 맵 Map in = n..
[프로그래머스, 12906] 같은 숫자는 싫어 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/12906 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 117 MB, 시간: 31.85 ms사용 알고리즘: 자료구조import java.util.*;public class Solution { public int[] solution(int []arr) { List list = new ArrayList(); list.add(arr[0]); for(int a : arr) { // 이전의 값과 동일하지 않을 ..
[프로그래머스, 138476] 귤 고르기 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/138476 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 165 MB, 시간: 206.32 ms사용 알고리즘: 정렬import java.util.*;class Solution { public int solution(int k, int[] tangerine) { // 인덱스에 해당하는 사이즈인 귤의 개수 int[] size = new int[10_000_001]; for(int s : tangerine) { ..