링크 : https://school.programmers.co.kr/learn/courses/30/lessons/12943
#include <string>
#include <vector>
#include <iostream>
using namespace std;
int solution(int n) {
int answer = 0;
long long num = n;
if(num == 1) {
answer = 0;
return answer;
}
while(num != 1){
if(num % 2 == 0) num = num / 2;
else num = (num * 3) + 1;
answer ++;
if(answer == 500) {
answer = -1;
break;
}
}
return answer;
}