Package g0501_0600.s0507_perfect_number
Class Solution
java.lang.Object
g0501_0600.s0507_perfect_number.Solution
507 - Perfect Number.<p>Easy</p>
<p>A <a href="https://en.wikipedia.org/wiki/Perfect_number" target="_top"><strong>perfect number</strong></a> is a <strong>positive integer</strong> that is equal to the sum of its <strong>positive divisors</strong> , excluding the number itself. A <strong>divisor</strong> of an integer <code>x</code> is an integer that can divide <code>x</code> evenly.</p>
<p>Given an integer <code>n</code>, return <code>true</code> <em>if</em> <code>n</code> <em>is a perfect number, otherwise return</em> <code>false</code>.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> num = 28</p>
<p><strong>Output:</strong> true</p>
<p><strong>Explanation:</strong> 28 = 1 + 2 + 4 + 7 + 14 1, 2, 4, 7, and 14 are all divisors of 28.</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> num = 7</p>
<p><strong>Output:</strong> false</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= num <= 10<sup>8</sup></code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
checkPerfectNumber
public boolean checkPerfectNumber(int num)
-