Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- Matrix
- Tree
- hash table
- 파이썬
- string
- SQL
- two pointers
- Binary Tree
- bit manipulation
- Math
- database
- Class
- java
- Number Theory
- simulation
- array
- geometry
- implement
- dynamic programming
- Binary Search
- 구현
- Stack
- Counting
- 자바
- Data Structure
- 코테
- greedy
- sorting
- Method
- 코딩테스트
Archives
- Today
- Total
코린이의 소소한 공부노트
[프로그래머스/Lv.0] 7의 개수 본문
1. Input
1) 정수 배열 array
2. Output
1) 배열에 담긴 숫자 7의 총 개수
3. Constraint
1) 1 ≤ array의 길이 ≤ 100
2) 0 ≤ array의 원소 ≤ 100,000
4. Example
Input: array={7,77,17} -> Output: 4
5. Code
1) 첫 코드(2022/10/31)
int answer = 0;
for(int i=0 ; i<array.length ; i++){
int num = array[i];
while(num>=1){
if(num%10==7)
answer++;
num /= 10;
} // while
} // for
return answer;
'코딩테스트 풀이 > JAVA' 카테고리의 다른 글
[프로그래머스/Lv.0] 중복된 숫자 개수 (0) | 2022.11.02 |
---|---|
[프로그래머스/Lv.0] 잘라서 배열로 저장하기 (0) | 2022.11.02 |
[프로그래머스/Lv.0] 문자열 정렬하기 (2) (0) | 2022.11.01 |
[프로그래머스/Lv.0] 세균 증식 (0) | 2022.11.01 |
[프로그래머스/Lv.0] 제곱수 판별하기 (0) | 2022.11.01 |