boolean isTheSameTree(TreeNode x, TreeNode root) {
        if (x == null || root == null) return x == root;
        return x.val == root.val && isTheSameTree(x.left, root.left) && isTheSameTree(x.right, root.right);
    }
Solution 1:
solution one building valid bst from preorder traversal of input tree and check if they are the same
src/problems/medium/ValidateBinarySearchTree.java