[ํ๋ก๊ทธ๋๋จธ์ค] ๊ณผ์ผ ์ฅ์ ๋ฌธ์ - Java
ยท
Algorithm/Programmers
ํ๋ก๊ทธ๋๋จธ์ค ์ค์ฟจ์ Lv1 ๊ณผ์ผ ์ฅ์ ๋ฌธ์ ๋ฅผ ์๋์ ๊ฐ์ด ํ์๋๋ฐ ์๊ฐ์ด๊ณผ๊ฐ ๋ด๋ค. class Solution { public int solution(int k, int m, int[] score) { int answer = 0; List intList = Arrays.stream(score) .boxed() .collect(Collectors.toList()); Collections.sort(intList, Collections.reverseOrder()); Stack stack = new Stack(); for (int i = 0; i < score.length - (score.length % m); i++) { stack.push(intList.remove(0)); if (stack.size() =..