240906

문제 : 삼총사 λ‚œμ΄λ„ : Lv.1

풀이

function solution(number) {
    let count = 0;


    for (let i = 0; i < number.length - 2; i++) {
        for (let j = i + 1; j < number.length - 1; j++) {
            for (let k = j + 1; k < number.length; k++) {
                if (number[i] + number[j] + number[k] === 0) {
                    count++;
                }
            }
        }
    }

    return count;
}

Last updated