코딩테스트입문

· Algorithms
-주사위의 개수 상자의 가로, 세로, 높이가 저장되어있는 배열 box와 주사위 모서리의 길이 정수 n이 매개변수로 주어졌을 때, 상자에 들어갈 수 있는 주사위의 최대 개수를 return class Solution { public int solution(int[] box, int n) { int answer = 0; answer = (box[0]/n) * (box[1]/n) * (box[2]/n); return answer; } } -합성수 찾기 class Solution { public int solution(int n) { int answer = 0; for (int i=3; i (int) IntStream.rangeClosed(1, i).filter(i2 -> i % i2 == 0).count() >..
유영서
'코딩테스트입문' 태그의 글 목록