Fastest possible Java solution, but not suited for an interview :-)


  • 0
    S
    public class Solution {
        public boolean checkPerfectNumber(int num) {
            return num == 6 || num == 28 || num == 496 || num == 8128 || num == 33550336;
        }
    }
    
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.