263. Ugly Number
Description
Difficulty: Easy
Related Topics: Math
An ugly number is a positive integer whose prime factors are limited to 2
, 3
, and 5
.
Given an integer n
, return true
if n
is an ugly number.
Example 1:
1 | Input: n = 6 |
Example 2:
1 | Input: n = 1 |
Example 3:
1 | Input: n = 14 |
Constraints:
- -231 <= n <= 231 - 1
Hints/Notes
- N/A
Solution
Language: C++
1 | class Solution { |