Ugly Number Problem

Ugly Number Problem — ExecCode Easy DSA Practice

Solve the Ugly Number problem on ExecCode. Free online easy DSA practice in Arrays - Basics. Write and run code in Java, C++, Python — no signup required to run.

Problem 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 ugly.

Examples

Input n = 6; Output true. Input n = 14; Output false

Constraints

-2^31 ≤ n ≤ 2^31 - 1

Practice Ugly Number free on ExecCode. Browse DSA problems, topic map, and placement guides.