492. Construct the Rectangle
class Solution(object):
def constructRectangle(self, area):
"""
:type area: int
:rtype: List[int]
"""
mid = int(math.sqrt(area))
while mid > 0:
if area % mid == 0:
return [int(area / mid), int(mid)]
mid -= 1
521. Longest Uncommon Subsequence I
class Solution(object):
def findLUSlength(self, a, b):
"""
:type a: str
:type b: str
:rtype: int
"""
if a == b:
return -1
return max(len(a), len(b))
530. Minimum Absolute Difference in BST
public class Solution {
int min = Integer.MAX_VALUE;
Integer prev = null;
public int getMinimumDifference(TreeNode root) {
if (root == null) return min;
getMinimumDifference(root.left);
if (prev != null) {
min = Math.min(min, root.val - prev);
}
prev = root.val;
getMinimumDifference(root.right);
return min;
}
}