problem263

package
v1.6.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 0 Imported by: 0

README

< Previous                  Next >

263. Ugly Number (Easy)

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

Ugly number is a positive number whose prime factors only include 2, 3, and/or 5.

 

Example 1:

Input: n = 6
Output: true
Explanation: 6 = 2 × 3

Example 2:

Input: n = 8
Output: true
Explanation: 8 = 2 × 2 × 2

Example 3:

Input: n = 14
Output: false
Explanation: 14 is not ugly since it includes another prime factor 7.

Example 4:

Input: n = 1
Output: true
Explanation: 1 is typically treated as an ugly number.

 

Constraints:

  • -231 <= n <= 231 - 1

[Math]

Similar Questions

  1. Happy Number (Easy)
  2. Count Primes (Easy)
  3. Ugly Number II (Medium)

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL