Description
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. Note that 1 is typically treated as an ugly number.
Examples
Input:
n = 6Output:
trueExplanation:
6 = 2 × 3.
Input:
n = 1Output:
trueExplanation:
1 is considered an ugly number (3^0 = 1).
Input:
n = 14Output:
falseExplanation:
14 = 2 * 7. Since 7 is not a factor of 2, 3, or 5, 14 is not an ugly number.
Constraints
- •
-2³¹ ≤ n ≤ 2³¹ - 1