Advertisement
sweet1cris

Untitled

Jan 9th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.46 KB | None | 0 0
  1. class Solution:
  2.     """
  3.    @param: : the given number
  4.    @return: whether whether there're two integers
  5.    """
  6.  
  7.     def checkSumOfSquareNumbers(self, num):
  8.         import math
  9.         if num < 0:
  10.             return False
  11.         if num == 0:
  12.             return True
  13.         root = int(math.sqrt(num))
  14.         for i in range(0,root+1):
  15.             j = math.sqrt(num - i*i)
  16.             if j == int(j):
  17.                 return True
  18.         return False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement