263. Ugly Number 发表于 2022-01-29 12345678910111213141516171819class Solution { public boolean isUgly(int n) { if (n <= 0) { return false; } while (n % 5 == 0) { n /= 5; } while (n % 3 == 0) { n /= 3; } while (n % 2 == 0) { n /= 2; } return n == 1; }} Reference263. Ugly Number