时空复杂度:
1 public class Solution {
2 public boolean isTweakedIdentical(TreeNode one, TreeNode two) {
3 // Write your solution here
4 if (one == null && two == null) {
5 return true ;
6 }
7 if (one == null || two == null || one.key != two.key) {
8 return false ;
9 }
10 //post process
11 return (isTweakedIdentical(one.left, two.left) && isTweakedIdentical(one.right, two.right)) ||
12 (isTweakedIdentical(one.left, two.right) && isTweakedIdentical(one.right, two.left));
13 }
14 }