File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
src/main/java/com/fishercoder/solutions Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 19
19
public class _951 {
20
20
public static class Solution1 {
21
21
public boolean flipEquiv (TreeNode root1 , TreeNode root2 ) {
22
- if (root1 == null && root2 == null ) return true ;
23
- if (root1 == null || root2 == null ) return false ;
22
+ if (root1 == null && root2 == null ) {
23
+ return true ;
24
+ }
25
+ if (root1 == null || root2 == null ) {
26
+ return false ;
27
+ }
24
28
25
- if (root1 .val != root2 .val ) return false ;
29
+ if (root1 .val != root2 .val ) {
30
+ return false ;
31
+ }
26
32
27
33
return (
28
- (flipEquiv (root1 .left , root2 .left ) && flipEquiv (root1 .right , root2 .right )) ||
29
- (flipEquiv (root1 .left , root2 .right ) && flipEquiv (root1 .right , root2 .left ))
34
+ (flipEquiv (root1 .left , root2 .left ) && flipEquiv (root1 .right , root2 .right ))
35
+ || (flipEquiv (root1 .left , root2 .right ) && flipEquiv (root1 .right , root2 .left ))
30
36
);
31
37
}
32
38
}
You can’t perform that action at this time.
0 commit comments