File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ class Solution {
2+ public int solution (int [] array ) {
3+ int answer = 0 ;
4+
5+ for (int num : array ){
6+ while (num >0 ){
7+ if (num %10 == 7 ) answer ++;
8+ num /=10 ;
9+ }
10+ }
11+
12+ return answer ;
13+ }
14+ }
Original file line number Diff line number Diff line change 1+ # [ level 0] 7의 개수 - 120912
2+
3+ [ 문제 링크] ( https://school.programmers.co.kr/learn/courses/30/lessons/120912 )
4+
5+ ### 성능 요약
6+
7+ 메모리: 61.5 MB, 시간: 0.01 ms
8+
9+ ### 구분
10+
11+ 코딩테스트 연습 > 코딩테스트 입문
12+
13+ ### 채점결과
14+
15+ 정확성: 100.0<br />합계: 100.0 / 100.0
16+
17+ ### 제출 일자
18+
19+ 2026년 05월 21일 09:12:05
20+
21+ ### 문제 설명
22+
23+ <p >머쓱이는 행운의 숫자 7을 가장 좋아합니다. 정수 배열 <code >array</code >가 매개변수로 주어질 때, 7이 총 몇 개 있는지 return 하도록 solution 함수를 완성해보세요.</p >
24+
25+ <hr >
26+
27+ <h5 >제한사항</h5 >
28+
29+ <ul >
30+ <li >1 ≤ <code >array</code >의 길이 ≤ 100</li >
31+ <li >0 ≤ <code >array</code >의 원소 ≤ 100,000</li >
32+ </ul >
33+
34+ <hr >
35+
36+ <h5 >입출력 예</h5 >
37+ <table class =" table " >
38+ <thead><tr>
39+ <th >array</th >
40+ <th >result</th >
41+ </tr >
42+ </thead >
43+ <tbody><tr>
44+ <td >[7, 77, 17]</td >
45+ <td >4</td >
46+ </tr >
47+ <tr >
48+ <td >[10, 29]</td >
49+ <td >0</td >
50+ </tr >
51+ </tbody >
52+ </table>
53+ <hr >
54+
55+ <h5 >입출력 예 설명</h5 >
56+
57+ <p >입출력 예 #1</p >
58+
59+ <ul >
60+ <li >[7, 77, 17]에는 7이 4개 있으므로 4를 return 합니다.</li >
61+ </ul >
62+
63+ <p >입출력 예 #2</p >
64+
65+ <ul >
66+ <li >[10, 29]에는 7이 없으므로 0을 return 합니다.</li >
67+ </ul >
68+
69+
70+ > 출처: 프로그래머스 코딩 테스트 연습, https://school.programmers.co.kr/learn/challenges
You can’t perform that action at this time.
0 commit comments