Ugly Number
思路一: 从数字中依次去除 2,3,5,查看剩余的值是否为 1
public boolean isUgly(int n) {
if (n == 0) return false;
while (n % 2 == 0) {
n /= 2;
}
while (n % 3 == 0) {
n /= 3;
}
while (n % 5 == 0) {
n /= 5;
}
return n == 1;
}
标签:return,int,263,while,easy,leetcode
From: https://www.cnblogs.com/iyiluo/p/16804871.html