Problems
Contests
Account
Problems
> Ugly Number > Editorial
Ugly Number — Solution & Editorial
Back to the Problem
Divide out 2s, 3s and 5s; N is ugly iff 1 remains.
Complexity:
O(√N) or better
×
Refer Job