Search⌘ K
AI Features

Solution: Ugly Number

C# solution for the Ugly Number problem using the Math and Geometry pattern.

Statement

Given an integer n, return true if n is an ugly number, and return false otherwise.

An ugly number is a positive integer whose prime factors are limited to 2, 3, and 5.

Note: 1 is considered an ugly number.

Constraints:

  • 231-2^{31} \leq ...