[Algorithm] 29 week(8.08 ~ 8.14) 3/3

Dev_min·2022년 8월 10일
0

algorithm

목록 보기
95/157

2315. Count Asterisks

var countAsterisks = function(s) {
    let possible = true;
    let count = 0;
    
    for(let i = 0; i < s.length; i++){
        if(s[i] === '|') possible = !possible;
        if(possible && s[i] === '*') count++;
    };
    
    return count;
};
profile
TIL record

0개의 댓글