Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3635bab

Browse files
conflict file update
1 parent bb1bf9c commit 3635bab

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

‎level-1/콜라츠-추측.js‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,20 @@ function solution(num) {
2929
num++;
3030
}
3131
}
32-
// 작업을 반복한 횟수 반환
33-
return cnt;
32+
}
33+
// 작업을 반복한 횟수 반환
34+
return cnt;
3435
}
3536

3637
//정답 3 - jaewon1676
3738
function solution(num) {
38-
var answer = 0;
39-
// num이 1이 아니고, answer이 500이 아니면 진행.
40-
// 두 가지 조건중 하나라도 맞지 않으면 while문 종료.
41-
while(num != 1 && answer != 500){
42-
//짝수면, 2로 나눠주고 홀수면 3을 곱하고 1을 더해준다.
43-
num % 2 == 0 ? (num = num / 2) : (num = num * 3 + 1);
44-
answer++;
45-
}
46-
return num == 1 ? answer : -1;
39+
var answer = 0;
40+
// num이 1이 아니고, answer이 500이 아니면 진행.
41+
// 두 가지 조건중 하나라도 맞지 않으면 while문 종료.
42+
while(num != 1 && answer != 500){
43+
//짝수면, 2로 나눠주고 홀수면 3을 곱하고 1을 더해준다.
44+
(num % 2 == 0 ? num = num / 2 : num = num * 3 + 1)
45+
answer++;
46+
}
47+
return num == 1 ? answer : -1
4748
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /