<commit_before>/*
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.
*/

public class IsSameTree {

  // Definition for a binary tree node.
  public static class TreeNode {
      int val;
      TreeNode left;
      TreeNode right;
      TreeNode(int x) { val = x; }
  }

  public static boolean isSameTree(TreeNode p, TreeNode q) {
    if (p == null && q == null) {
      return true;
    } else if (p != null && q != null) {
      return ( (p.val == q.val) && isSameTree(p.left, q.left) && isSameTree(p.right, q.right) );
    } else { // one of them is null and the other one is not.
      return false;
    }
  }
}<commit_msg>Updated solution for IsSameTree.java<commit_after>/*
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.
*/

public class IsSameTree {

  // Definition for a binary tree node.
  public static class TreeNode {
      int val;
      TreeNode left;
      TreeNode right;
      TreeNode(int x) { val = x; }
  }

  public static boolean isSameTree(TreeNode p, TreeNode q) {
    if (p == null && q == null) return true;
    if (p == null || q == null) return false; // only 1 of them is null
    if (p.val != q.val) return false; // none of them is null
    return isSameTree(p.left, q.left) && isSameTree(p.right, q.right);
  }
}
{'fraction_non_alphanumeric': 0.10210803689064558, 'fraction_numerical': 0.0006587615283267457, 'mean_word_length': 2.7139364303178484, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4033477', 'n_tokens_mistral': 472, 'n_tokens_neox': 459, 'n_words': 200}