목록코딩테스트 (43)
오늘이라도

문제 내 풀이 import java.util.stream.IntStream; class Solution { public int solution(int n) { return (int) IntStream.rangeClosed(1, n).filter(value -> n % value == 0).count(); } } 채점 결과 피드백

문제 내 풀이 import java.util.Arrays; import java.util.Collections; import java.util.stream.IntStream; class Solution { public int[] solution(int[] emergency) { int[] order = IntStream.of(emergency) .boxed() .sorted(Collections.reverseOrder()) .mapToInt(value -> value.intValue()) .toArray(); int[] answer = new int[emergency.length]; for(int i = 0; i < order.length; i++) { for(int j = 0; j < emergency..

문제 내 풀이 채점 결과 피드백 import java.util.stream.Collectors; class Solution { public String solution(int age) { return String.valueOf(age).chars().mapToObj(operand -> String.valueOf((char) (49 + operand))).collect(Collectors.joining()); } } mapToObj https://dev-kani.tistory.com/32 Collectors.joining() https://bactoria.tistory.com/74

문제 내 풀이 채점 결과 피드백 Arrays.copyOf(원본배열, 복사할 길이); Arrays.copyOfRange(원본 배열, 복사할 시작인덱스, 복사할 끝인덱스) 인덱스는 0부터 시작하는것 기준