507. Perfect Number Easy

@problem@discussion
#Math



1/**
2 * [507] Perfect Number
3 *
4 * A <a href="https://en.wikipedia.org/wiki/Perfect_number" target="_blank">perfect number</a> is a positive integer that is equal to the sum of its positive divisors, excluding the number itself. A divisor of an integer x is an integer that can divide x evenly.
5 * Given an integer n, return true if n is a perfect number, otherwise return false.
6 *  
7 * Example 1:
8 * 
9 * Input: num = 28
10 * Output: true
11 * Explanation: 28 = 1 + 2 + 4 + 7 + 14
12 * 1, 2, 4, 7, and 14 are all divisors of 28.
13 * 
14 * Example 2:
15 * 
16 * Input: num = 7
17 * Output: false
18 * 
19 *  
20 * Constraints:
21 * 
22 * 	1 <= num <= 10^8
23 * 
24 */
25pub struct Solution {}
26
27// problem: https://leetcode.com/problems/perfect-number/
28// discuss: https://leetcode.com/problems/perfect-number/discuss/?currentPage=1&orderBy=most_votes&query=
29
30// submission codes start here
31
32impl Solution {
33    pub fn check_perfect_number(num: i32) -> bool {
34        false
35    }
36}
37
38// submission codes end
39
40#[cfg(test)]
41mod tests {
42    use super::*;
43
44    #[test]
45    fn test_507() {
46    }
47}
48


Back
© 2025 bowen.ge All Rights Reserved.