Ugly Number Problem
Ugly Number Problem — ExecCode School DSA Practice
Solve the Ugly Number problem on ExecCode. Free online school DSA practice in Math. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Given an integer N, determine if it is an ugly number. Your task is to solve Ugly Number. Ugly numbers are positive integers whose prime factors only include 2, 3, or 5.
Examples
Input 6; Output True. Input 1; Output True
Constraints
0 <= N <= 2^31 - 1
Practice Ugly Number free on ExecCode. Browse DSA problems, topic map, and placement guides.