landscapemi的博客

###### leetcode:数学：Ugly Number(263)

Write a program to check whether a given number is an ugly number.

Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly since it includes another prime factor 7.

Note that 1 is typically treated as an ugly number.

class Solution {
public:
bool isUgly(int num) {
if (num <= 0)
return false;
while (num % 2 == 0)
num /= 2;
while (num % 3 == 0)
num /= 3;
while (num % 5 == 0)
num /= 5;
return num == 1;
}
};

#### leetcode 263: Ugly Number

2015-08-19 20:17:44

#### [Leetcode-263] Ugly Number（丑陋数）

2015-09-05 10:57:39

#### LeetCode263——Ugly Number

2015-08-24 21:35:15

#### 剑指offer 面试题34：寻找丑数(Leetcode 263.ugly number)解题报告

2016-05-07 10:13:47

#### leetcode-java-263. Ugly Number

2016-08-21 19:11:58

#### [Leetcode 264] Ugly Number II

2015-09-02 00:23:05

#### [leetcode] 264. Ugly Number II 解题报告

2015-12-13 15:54:50

#### leetcode_263. Ugly Number 寻找丑数，即质因数只能是2，3，5的数

2016-10-23 17:37:29

#### LeetCode 313. Super Ugly Number

2016-03-29 23:24:34

#### 【LEETCODE】313-Super Ugly Number [Python]

2016-01-26 16:32:03

## 不良信息举报

leetcode:数学：Ugly Number(263)