
Algorithm/프로그래머스
[알고리즘] 길이에 따른 연산 Java
class Solution { public int solution(int[] num_list) { int answer = 0; int length = num_list.length; if (length >= 11) { for (int i : num_list) { answer+=i; } } else if(length 10?stream.sum():stream.reduce(1, (a, b) -> a * b); } }