https://school.programmers.co.kr/learn/courses/30/lessons/120847 import java.util.Arrays; class Solution { public int solution(int[] numbers) { Arrays.sort(numbers); int answer = numbers[numbers.length-2] * numbers[numbers.length-1]; return answer; } }
ALGORITHM ๐ค/Programmers
ํ๋ก๊ทธ๋๋จธ์คhttps://school.programmers.co.kr/learn/courses/30/lessons/120815 class Solution { public int solution(int n) { int max = 0; for(int i=1; i
https://school.programmers.co.kr/learn/courses/30/lessons/120813 class Solution { public int[] solution(int n) { int[] answer = new int[(n / 2) + (n % 2)]; // ๋ฐฐ์ด์ ํฌ๊ธฐ ์ง์ int a = 1; for(int i = 0; i < answer.length; i++){ // ๋ฐฐ์ด ํฌ๊ธฐ๋งํผ ๋ฐ๋ณต answer[i] = a; // ํ์๋ง ๋ด๊ธฐ a += 2; } return answer; } }
https://school.programmers.co.kr/learn/courses/30/lessons/120811 import java.util.Arrays; // ํด๋์ค ์ ์ class Solution { public int solution(int[] array) { Arrays.sort(array); // ์ ๋ ฌ ๋ฉ์๋ ์ฌ์ฉํ์ฌ ์ค๋ฆ์ฐจ์ ์ ๋ ฌ int answer = array[array.length/2]; // ์ค์๊ฐ ๊ตฌํ๊ธฐ return answer; } }
https://school.programmers.co.kr/learn/courses/30/lessons/120808?language=java class Solution { public int[] solution(int numer1, int denom1, int numer2, int denom2) { int numer = (numer1 * denom2) + (numer2 * denom1); // ํต๋ถํ์ ๋ ๋ถ์ int denom = denom1 * denom2; // ํต๋ถํ์ ๋ ๋ถ๋ชจ for(int i = numer - 1; i > 1; i--){ // ๊ธฐ์ฝ๋ถ์ ์ธ์ง ์ฒดํฌ if(numer % i == 0 && denom % i == 0){ // ๊ธฐ์ฝ๋ถ์๊ฐ ์๋๋ฉด ์ฝ๋ถํด์ฃผ๊ธฐ numer /= i; denom..
https://school.programmers.co.kr/learn/courses/30/lessons/120833 class Solution { public int[] solution(int[] numbers, int num1, int num2) { int[] answer = new int [num2 - num1 + 1]; // ๋ฐฐ์ด์ ํฌ๊ธฐ๋ฅผ ์ค์ int a = 0; for(int i = num1; i