dsa · easy

Ugly Number

An ugly number is a positive integer whose prime factors are only 2, 3, and/or 5. 1 is ugly. Return whether n is ugly.

Arguments

Example

n = 6true (2×3). n = 14false (has a 7). n = 1true.

Constraints

-2^31 <= n <= 2^31 - 1 Hidden tests include near-max size for this bound; a slower-than-intended solution TLEs.

Examples

Example 1

Input:
6

Expected:
true

Example 2

Input:
1

Expected:
true

Example 3

Input:
14

Expected:
false

Open in the Dojo editor