Easy
Quiz
#507 Perfect Number
APPROACH
A positive integer is called perfect when its value equals the sum of all its proper divisors — that is, all divisors except the number itself. A proper divisor of x is any positive integer less than x that divides x without a remainder.
Given an integer n, return true if n is a perfect number, or false otherwise.
Example 1:
Input: num = 28
Output: true
Explanation: 28 = 1 + 2 + 4 + 7 + 14
1, 2, 4, 7, and 14 are all divisors of 28.
Example 2:
Input: num = 7
Output: false
1 of 4
1:00
What is the optimal approach for this problem?