[알고리즘] 10부제

soheeoott·2021년 5월 20일
0

알고리즘

목록 보기
7/9
post-thumbnail
function solution(arr, num){
  let cnt = 0;

  for(i of arr){
    let chk = i.toString().indexOf(num.toString());

    if(chk !== -1){
      cnt += 1;
    }
  }
  return cnt;
}
let arr = [25, 23, 11, 47, 53, 17, 33];
console.log(solution(arr, 3));
profile
📚 글쓰는 습관 들이기 📚

0개의 댓글