https://programmers.co.kr/learn/courses/30/lessons/12943?language=javascript
function solution(num) {
let number = num;
let count = 0;
while (number !== 1) {
if (count >= 500) {
count = -1;
break;
}
if (number % 2 === 0) { // 짝수
number /= 2;
} else { // 홀수
number = number * 3 + 1;
}
count++;
}
const answer = count;
return answer;
}