数字问题
题目
代码
public class Solution {
/**
* @param n: the number n
* @return: the times n convert to 1
*/
public int digitConvert(int n) {
// Write your code here
int total=0;
while (n!=1){
if(((n&1)==1)){
n=3*n+1;
}else {
n=n/2;
}
total++;
}
return total;
}
}