본문 바로가기

알고리즘 공부

등차수열

class Solution {
    public int solution(int a, int d, boolean[] included) {
        int answer = 0;

        for(int i = 0; i < included.length; i++){
            if(included[i]){
                answer +=  a + (d*i);
            }
        }

        return answer;
    }
}

'알고리즘 공부' 카테고리의 다른 글

자바 tostring 메소드  (0) 2023.12.08
주사위 게임  (0) 2023.12.08
SQL에서 Char와 Varchar2의 차이점  (1) 2023.12.05
자바 append와 concat의 공통점 및 차이점  (0) 2023.12.03
자바 boolean  (2) 2023.12.03