본문 바로가기

Coding Test/프로그래머스

[프로그래머스/자바] 머쓱이보다 키 큰 사람

class Solution {
    public int solution(int[] array, int height) {
        int answer = 0;
        for(int num : array) {
            if(num > height) answer ++;
        }
        return answer;
    }
}

import java.util.Arrays;

class Solution {
    public int solution(int[] array, int height) {
        return (int) Arrays.stream(array).filter(value -> value > height).count();
    }
}