Python 1-liner (when the <input, output> pairs of a mapping can be exhausted)


  • 0

    That's what happened when the <input, output> pairs of any problem can be exhausted. In other words, as long as the mapping behavior of a function is fixed, one cannot distinguish how the function is actually implemented.

        def checkPerfectNumber(self, num):
            return num in [6, 28, 496, 8128, 33550336]
    

    For example, given integer n > 0, write a function to return true iff x^n + y^n = z^n has positive integer solution (x, y, z).


Log in to reply
 

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