전체 글
[프로그래머스, 77484] 로또의 최고 순위와 최저 순위 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/77484 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 77.2 MB, 시간: 0.03 ms사용 알고리즘: 구현class Solution { public int[] solution(int[] lottos, int[] win_nums) { int[] answer = {7, 7}; for(int i = 0; i
[프로그래머스, 181853] 뒤에서 5등까지 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/181853 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 88.2 MB, 시간: 0.50 ms사용 알고리즘: 구현import java.util.*;class Solution { public int[] solution(int[] num_list) { // 정렬 Arrays.sort(num_list); // 가장 작은 5개 담기 int[] answer = new int[5]; for(int i = 0..
[프로그래머스, 181854] 배열의 길이에 따라 다른 연산하기 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/181854 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 92.9 MB, 시간: 0.05 ms사용 알고리즘: 구현class Solution { public int[] solution(int[] arr, int n) { int start = 0; if(arr.length % 2 == 0) start = 1; for(int i = start; i
[프로그래머스, 181855] 문자열 묶기 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/181855 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 125 MB, 시간: 25.73 ms사용 알고리즘: 자료구조import java.util.*;class Solution { public int solution(String[] strArr) { int answer = 0; // key := 문자열 길이 // value := 개수 Map map = new HashMap(); in..
[프로그래머스, 181857] 배열의 길이를 2의 거듭제곱으로 만들기 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/181857 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 89.5 MB, 시간: 0.05 ms사용 알고리즘: 구현class Solution { public int[] solution(int[] arr) { // 배열 길이 구하기 int length = 1; while(arr.length > length) length *= 2; int[] answer = new int[length]; ..
[백준, BOJ 1976] 여행 가자 (java)
https://www.acmicpc.net/problem/1976메모리: 16,704 KB , 시간: 192 ms사용 알고리즘: 그래프 이론, 그래프 탐색, 플로이드-워셜import java.io.BufferedReader;import java.io.InputStreamReader;import java.util.StringTokenizer;public class Main { public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st; int N = Inte..
[프로그래머스, 181858] 무작위로 K개의 수 뽑기 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/181858 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 95.5 MB, 시간: 1.62 ms사용 알고리즘: 구현, 자료구조import java.util.*;class Solution { public int[] solution(int[] arr, int k) { // 중복 체크를 위한 Set Set set = new HashSet(); int[] answer = new int[k]; int index = 0;..
[프로그래머스, 181859] 배열 만들기 6 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/181859 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 125 MB, 시간: 41.97 ms사용 알고리즘: 구현import java.util.*;class Solution { public int[] solution(int[] arr) { // stk의 원소를 임시 저장할 List List list = new ArrayList(); for(int i = 0; i 배열 if(list.isEmpty()) ret..
[프로그래머스, 181860] 빈 배열에 추가, 삭제하기 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/181860 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 80.5 MB, 시간: 0.78 ms사용 알고리즘: 자료구조import java.util.*;class Solution { public int[] solution(int[] arr, boolean[] flag) { // X의 원소들을 임시로 담아둘 Deque ArrayDeque dq = new ArrayDeque(); for(int i = 0; i 배열 ..
[프로그래머스, 181861] 배열의 원소만큼 추가하기 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/181861 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 76.4 MB, 시간: 2.01 ms사용 알고리즘: 구현import java.util.*;class Solution { public int[] solution(int[] arr) { // X의 원소를 임시로 담아둘 리스트 List list = new ArrayList(); for(int a : arr) { for(int i = 0; i