Skip to content

Commit 1fa60fe

Browse files
committed
[level 1] Title: 콜라츠 추측, Time: 0.02 ms, Memory: 73.6 MB -BaekjoonHub
1 parent fe38abd commit 1fa60fe

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

프로그래머스/1/12943. 콜라츠 추측/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# [level 1] 콜라츠 추측 - 12943
22

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

55
### 성능 요약
66

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

99
### 구분
1010

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

1717
### 제출 일자
1818

19-
2024년 06월 26일 11:12:36
19+
2026년 06월 21일 15:04:00
2020

2121
### 문제 설명
2222

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

0 commit comments

Comments
 (0)