class Solution { public int solution(int[] numbers) { int answer = 0; for (int i = 0; i < 10; i++) { answer += i; } fo..
import java.util.*;class Solution { public int[] solution(int[] arr, int divisor) { int[] answer = Arrays.stream(arr) .filter(item -> (item % divisor) == 0) .sorted() ..
class Solution { public int[] solution(int[] arr, int[][] queries) { for(int i = 0; i < queries.length; i++) { int idx1 = queries[i][0]; int idx2 = queries[i][1]; int tmp = arr[idx1]; arr[idx1] = arr[idx2]; arr[idx2] = tmp; } int[] answer = arr; return answer; } }
import java.util.*; class Solution { public int[] solution(String[] intStrs, int k, int s, int l) { return Arrays.stream(intStrs) .mapToInt(item -> Integer.parseInt(item.substring(s, s+l))) .filter(item -> k < item) .toArray(); } }
class Solution { public int[][] solution(int[] num_list, int n) { int[][] answer = new int [num_list.length/n][n]; int idx = 0; for(int i = 0; i < answer.length; i++) { int[] tmp = new int [n]; for(int j = 0; j < n; j++) { tmp[j] = num_list[idx++]; } answer[i] = tmp; } return answer; } }