Construct the Rectangle
就是一个O(√n)的算法,需要注意提前返回结果就好
class Solution(object):
def constructRectangle(self, area):
"""
:type area: int
:rtype: List[int]
"""
for i in xrange(int(area ** 0.5), 0, -1):
if area % i == 0:
return sorted([i, area / i], reverse=True)
return []