Construct the Rectangle LeetCode solution in Python
1# Runtime: 39 ms (Top 86.68%) | Memory: 13.9 MB (Top 58.98%)2class Solution:3def constructRectangle(self, area: int):4y = Solution.mySqrt(area)5for i in range(y, 0, -1):6if not area % i:7return [int(area / i), i]89def mySqrt(x):10if x == 0:11return 012n = x13count = 014while True:15count += 116root = 0.5 * (n + (x / n))17if abs(root - n) < 0.9:18break19n = root20return int(root)