https://school.programmers.co.kr/learn/courses/30/lessons/138476 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr import java.util.*;class Solution { public int solution(int k, int[] tangerine) { int answer = 0; int n = tangerine.length; Arrays.sort(tangerine); Stack stack = new Stack(); for(int i = 0; i = 0..
https://school.programmers.co.kr/learn/courses/30/lessons/42748 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr - 첫 번째 풀이 (배열을 직접 자름)import java.util.*;class Solution { public int[] solution(int[] array, int[][] commands) { int[] answer = new int[commands.length]; for(int i = 0; i - 두 번째 풀이 (배열을 함수를 이용해 자름)import java.util.*;class Sol..
https://school.programmers.co.kr/learn/courses/30/lessons/1845 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr import java.util.*;class Solution { public int solution(int[] nums) { int answer = 0; int max = nums.length/2; HashSet numsSet = new HashSet(); for(int n : nums){ numsSet.add(n); ..
https://school.programmers.co.kr/learn/courses/30/lessons/12906 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr import java.util.*;public class Solution { public int[] solution(int []arr) { Stack stack = new Stack(); for(int i : arr){ if(stack.empty() || !stack.peek().equals(i)){ stack.push(i); } ..