프로그래머스
[프로그래머스, 12940] 최대공약수와 최소공배수 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/12940 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 78.9 MB, 시간: 0.02 ms사용 알고리즘: 구현class Solution { public int[] solution(int n, int m) { int[] answer = new int[2]; answer[0] = gcd(n, m); answer[1] = lcm(n, m); return answer; } int gcd(int a..
[프로그래머스, 76501] 음양 더하기 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/76501 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 78 MB, 시간: 0.07 ms사용 알고리즘: 구현class Solution { public int solution(int[] absolutes, boolean[] signs) { int answer = 0; for(int i = 0; i
[프로그래머스, 118667] 두 큐 합 같게 만들기 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/118667 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 146 MB, 시간: 20.26 ms사용 알고리즘: 투 포인터import java.util.*;class Solution { public int solution(int[] queue1, int[] queue2) { // 두 배열 합치기 int[] queue = new int[queue1.length + queue2.length]; // 투 포인터 int..
[프로그래머스, 68644] 두 개 뽑아서 더하기 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/68644 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 72.1 MB, 시간: 1.68 ms사용 알고리즘: 완전탐색, 자료 구조import java.util.*;class Solution { public int[] solution(int[] numbers) { // 중복 제거를 위한 set Set set = new HashSet(); for(int i = 0; i
[프로그래머스, 12950] 행렬의 덧셈 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/12950 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 118 MB, 시간: 9.44 ms사용 알고리즘: 구현class Solution { public int[][] solution(int[][] arr1, int[][] arr2) { int[][] answer = new int[arr1.length][arr1[0].length]; for(int i = 0; i
[프로그래머스, 12922] 수박수박수박수박수박수? (java)
https://school.programmers.co.kr/learn/courses/30/lessons/12922 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 76.4 MB, 시간: 0.98 ms사용 알고리즘: 구현import java.util.*;class Solution { public String solution(int n) { StringBuilder answer = new StringBuilder(); for(int i = 0; i
[프로그래머스, 176963] 추억 점수 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/176963 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 105 MB, 시간: 2.69 ms사용 알고리즘: 자료구조import java.util.*;class Solution { public int[] solution(String[] name, int[] yearning, String[][] photo) { // 그리움 정보를 담을 Map Map score = new HashMap(); for(int i = 0; i
[프로그래머스, 12926] 시저 암호 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/12926 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 76.4 MB, 시간: 1.43 ms사용 알고리즘: 문자열import java.util.*;class Solution { public String solution(String s, int n) { StringBuilder answer = new StringBuilder(); char c; for(int i = 0; i = 'A' && c = 'a' && c
[프로그래머스, 340212] [PCCP 기출문제] 2번 / 퍼즐 게임 챌린지 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/340212 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 120 MB, 시간: 45.40 ms사용 알고리즘: 이분탐색class Solution { public int solution(int[] diffs, int[] times, long limit) { int answer = 0; // 이분탐색 int s = 1, e = 100_000, m; long t; while(s m) t += (times[i - 1]..
[프로그래머스, 86491] 최소직사각형 (java)
https://school.programmers.co.kr/learn/courses/30/lessons/86491 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr메모리: 85.9 MB, 시간: 2.32 ms사용 알고리즘: 완전탐색class Solution { public int solution(int[][] sizes) { // 명함의 더 긴 쪽이 무조건 가로로 오게 해서 최대값 구하기 int x = 0, y = 0; int row, column; for(int i = 0; i