Skip to content

Commit 0484985

Browse files
author
xuebu
committed
add note
1 parent 473a9b1 commit 0484985

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

.DS_Store

0 Bytes
Binary file not shown.

math/construct-the-rectangle-492.java

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Solution {
2+
public int[] constructRectangle(int area) {
3+
int sqrt = (int) Math.sqrt(area);
4+
while (area % sqrt != 0) {
5+
sqrt--;
6+
}
7+
return new int[]{area / sqrt, sqrt};
8+
}
9+
}
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution {
2+
public boolean flipEquiv(TreeNode root1, TreeNode root2) {
3+
return isEqual(root1,root2);
4+
}
5+
public boolean isEqual(TreeNode root1,TreeNode root2){
6+
if (root1 == null && root2 == null) return true;
7+
if ( (root1 == null && root2 != null) || (root1 != null && root2 == null) || (root1.val!=root2.val) ) return false;
8+
return isEqual(root1.left,root2.right)&&isEqual(root1.right,root2.left)
9+
||isEqual(root1.left,root2.left)&&isEqual(root1.right,root2.right);
10+
}
11+
}

0 commit comments

Comments
 (0)