Skip to content

Commit 8fabb64

Browse files
committed
[level 0] Title: 자릿수 더하기, Time: 0.03 ms, Memory: 73.2 MB -BaekjoonHub
1 parent 8d3d45d commit 8fabb64

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

프로그래머스/0/120906. 자릿수 더하기/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# [level 0] 자릿수 더하기 - 120906
22

3-
[문제 링크](https://school.programmers.co.kr/learn/courses/30/lessons/120906)
3+
[문제 링크](https://school.programmers.co.kr/learn/courses/30/lessons/120906?language=java)
44

55
### 성능 요약
66

7-
메모리: 10.2 MB, 시간: 0.02 ms
7+
메모리: 73.2 MB, 시간: 0.03 ms
88

99
### 구분
1010

@@ -16,7 +16,7 @@
1616

1717
### 제출 일자
1818

19-
2024년 06월 01일 10:09:29
19+
2026년 06월 21일 13:44:30
2020

2121
### 문제 설명
2222

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Solution {
2+
public int solution(int n) {
3+
int ans = 0;
4+
while (true) {
5+
if (n / 10 < 1) {
6+
ans += n % 10;
7+
return ans;
8+
}
9+
ans += n % 10;
10+
n = n / 10;
11+
}
12+
}
13+
}

0 commit comments

Comments
 (0)