263. Ugly Number Easy

@problem@discussion
#Math



1/**
2 * [263] Ugly Number
3 *
4 * An ugly number is a positive integer whose prime factors are limited to 2, 3, and 5.
5 * Given an integer n, return true if n is an ugly number.
6 *  
7 * Example 1:
8 * 
9 * Input: n = 6
10 * Output: true
11 * Explanation: 6 = 2 × 3
12 * 
13 * Example 2:
14 * 
15 * Input: n = 1
16 * Output: true
17 * Explanation: 1 has no prime factors, therefore all of its prime factors are limited to 2, 3, and 5.
18 * 
19 * Example 3:
20 * 
21 * Input: n = 14
22 * Output: false
23 * Explanation: 14 is not ugly since it includes the prime factor 7.
24 * 
25 *  
26 * Constraints:
27 * 
28 * 	-2^31 <= n <= 2^31 - 1
29 * 
30 */
31pub struct Solution {}
32
33// problem: https://leetcode.com/problems/ugly-number/
34// discuss: https://leetcode.com/problems/ugly-number/discuss/?currentPage=1&orderBy=most_votes&query=
35
36// submission codes start here
37
38impl Solution {
39    pub fn is_ugly(n: i32) -> bool {
40        false
41    }
42}
43
44// submission codes end
45
46#[cfg(test)]
47mod tests {
48    use super::*;
49
50    #[test]
51    fn test_263() {
52    }
53}
54


Back
© 2025 bowen.ge All Rights Reserved.