function solution(num) {
let count = 0;
function collatz (num) {
if (num === 1) return count;
if (count === 500) return -1;
if (num % 2 === 0) num /= 2;
else num = num * 3 + 1;
count++;
return collatz(num);
}
return collatz(num);
}
재귀함수에 리턴적어주기