package com.fishercoder.solutions;

import com.fishercoder.common.classes.TreeNode;

/**
 * 100. Same Tree
 *
 * Given two binary trees, write a function to check if they are equal or not. Two binary trees are
 * considered equal if they are structurally identical and the nodes have the same value.
 *
 * Example 1:
 *
 * Input:     1         1
 *           / \       / \
 *          2   3     2   3
 *
 *         [1,2,3],   [1,2,3]
 *
 * Output: true
 *
 * Example 2:
 *
 * Input:     1         1
 *           /           \
 *          2             2
 *
 *         [1,2],     [1,null,2]
 *
 * Output: false
 *
 * Example 3:
 *
 * Input:     1         1
 *           / \       / \
 *          2   1     1   2
 *
 *         [1,2,1],   [1,1,2]
 *
 * Output: false
 */

public class _100 {
  public static class Solution1 {
    public boolean isSameTree(TreeNode p, TreeNode q) {
      if (p == null || q == null) {
        return p == q;
      }
      return p.val == q.val && isSameTree(p.left, q.left) && isSameTree(p.right, q.right);
    }
  }
}

@@ -86,729 +86,8 @@
 %0D%0A%0D%0A
-/**%0D%0A * 100. Same Tree%0D%0A *%0D%0A * Given two binary trees, write a function to check if they are equal or not. Two binary trees are%0D%0A * considered equal if they are structurally identical and the nodes have the same value.%0D%0A *%0D%0A * Example 1:%0D%0A *%0D%0A * Input:     1         1%0D%0A *           / %5C       / %5C%0D%0A *          2   3     2   3%0D%0A *%0D%0A *         %5B1,2,3%5D,   %5B1,2,3%5D%0D%0A *%0D%0A * Output: true%0D%0A *%0D%0A * Example 2:%0D%0A *%0D%0A * Input:     1         1%0D%0A *           /           %5C%0D%0A *          2             2%0D%0A *%0D%0A *         %5B1,2%5D,     %5B1,null,2%5D%0D%0A *%0D%0A * Output: false%0D%0A *%0D%0A * Example 3:%0D%0A *%0D%0A * Input:     1         1%0D%0A *           / %5C       / %5C%0D%0A *          2   1     1   2%0D%0A *%0D%0A *         %5B1,2,1%5D,   %5B1,1,2%5D%0D%0A *%0D%0A * Output: false%0D%0A */%0D%0A%0D%0A
 publ
@@ -103,16 +103,18 @@
 _100 %7B%0D%0A
+  
   public
@@ -140,24 +140,28 @@
 ion1 %7B%0D%0A    
+ 
+   
 public boole
@@ -197,24 +197,30 @@
 eNode q) %7B%0D%0A
+      
       if (p 
@@ -248,24 +248,32 @@
  %7B%0D%0A        
+   
+     
 return p == 
@@ -282,19 +282,31 @@
 %0D%0A      
-%7D%0D%0A
+      %7D%0D%0A      
       re
@@ -389,23 +389,29 @@
 ight);%0D%0A
+    
     %7D%0D%0A
+  
   %7D%0D%0A%7D%0D%0A

refactor 100